Skip to content

Commit 74b4243

Browse files
refactor: default exports
1 parent 21385dc commit 74b4243

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

src/components/Tooltip/Tooltip.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import classNames from 'classnames'
44
import debounce from 'utils/debounce'
55
import { useTooltip } from 'components/TooltipProvider'
66
import useIsomorphicLayoutEffect from 'utils/use-isomorphic-layout-effect'
7-
import { getScrollParent } from 'utils/get-scroll-parent'
8-
import { computeTooltipPosition } from 'utils/compute-positions'
7+
import computeTooltipPosition from 'utils/compute-positions'
98
import type { IComputedPosition } from 'utils/compute-positions-types'
10-
import { cssTimeToMs } from 'utils/css-time-to-ms'
9+
import cssTimeToMs from 'utils/css-time-to-ms'
1110
import { deepEqual } from 'utils/deep-equal'
11+
import getScrollParent from 'utils/get-scroll-parent'
1212
import coreStyles from './core-styles.module.css'
1313
import styles from './styles.module.css'
1414
import type {

src/test/utils.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import debounce from 'utils/debounce'
2-
import { computeTooltipPosition } from 'utils/compute-positions'
3-
import { cssTimeToMs } from 'utils/css-time-to-ms'
2+
import computeTooltipPosition from 'utils/compute-positions'
3+
import cssTimeToMs from 'utils/css-time-to-ms'
44

55
// Tell Jest to mock all timeout functions
66
jest.useRealTimers()

src/utils/compute-positions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { computePosition, offset, shift, arrow, flip } from '@floating-ui/dom'
22
import type { IComputePositions } from './compute-positions-types'
33

4-
export const computeTooltipPosition = async ({
4+
const computeTooltipPosition = async ({
55
elementReference = null,
66
tooltipReference = null,
77
tooltipArrowReference = null,
@@ -96,3 +96,5 @@ export const computeTooltipPosition = async ({
9696
return { tooltipStyles: styles, tooltipArrowStyles: {}, place: placement }
9797
})
9898
}
99+
100+
export default computeTooltipPosition

src/utils/css-time-to-ms.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
export const cssTimeToMs = (time: string): number => {
1+
const cssTimeToMs = (time: string): number => {
22
const match = time.match(/^([\d.]+)(ms|s)$/)
33
if (!match) {
44
return 0
55
}
66
const [, amount, unit] = match
77
return Number(amount) * (unit === 'ms' ? 1 : 1000)
88
}
9+
10+
export default cssTimeToMs

src/utils/get-scroll-parent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const isScrollable = (node: Element) => {
99
})
1010
}
1111

12-
export const getScrollParent = (node: Element | null) => {
12+
const getScrollParent = (node: Element | null) => {
1313
if (!node) {
1414
return null
1515
}
@@ -22,3 +22,5 @@ export const getScrollParent = (node: Element | null) => {
2222
}
2323
return document.scrollingElement || document.documentElement
2424
}
25+
26+
export default getScrollParent

0 commit comments

Comments
 (0)