File tree 4 files changed +16
-20
lines changed
packages/coreui-react/src 4 files changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -10,18 +10,9 @@ import React, {
10
10
import PropTypes from 'prop-types'
11
11
import classNames from 'classnames'
12
12
13
+ import { isVisible } from '../../utils'
13
14
import { useForkedRef } from '../../utils/hooks'
14
15
15
- const isVisible = ( element : HTMLDivElement ) => {
16
- const rect = element . getBoundingClientRect ( )
17
- return (
18
- rect . top >= 0 &&
19
- rect . left >= 0 &&
20
- rect . bottom <= ( window . innerHeight || document . documentElement . clientHeight ) &&
21
- rect . right <= ( window . innerWidth || document . documentElement . clientWidth )
22
- )
23
- }
24
-
25
16
export interface CCarouselProps extends HTMLAttributes < HTMLDivElement > {
26
17
/**
27
18
* index of the active item.
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { createPortal } from 'react-dom'
3
3
import PropTypes from 'prop-types'
4
4
import classNames from 'classnames'
5
5
6
+ import { isVisible } from '../../utils'
6
7
import { useForkedRef } from '../../utils/hooks'
7
8
import { CBackdrop } from '../backdrop/CBackdrop'
8
9
@@ -52,16 +53,6 @@ export interface CSidebarProps extends HTMLAttributes<HTMLDivElement> {
52
53
const isOnMobile = ( element : HTMLDivElement ) =>
53
54
Boolean ( getComputedStyle ( element ) . getPropertyValue ( '--cui-is-mobile' ) )
54
55
55
- const isVisible = ( element : HTMLDivElement ) => {
56
- const rect = element . getBoundingClientRect ( )
57
- return (
58
- rect . top >= 0 &&
59
- rect . left >= 0 &&
60
- rect . bottom <= ( window . innerHeight || document . documentElement . clientHeight ) &&
61
- rect . right <= ( window . innerWidth || document . documentElement . clientWidth )
62
- )
63
- }
64
-
65
56
export const CSidebar = forwardRef < HTMLDivElement , CSidebarProps > (
66
57
(
67
58
{
Original file line number Diff line number Diff line change
1
+ import isVisible from './isVisible'
2
+
3
+ export { isVisible }
Original file line number Diff line number Diff line change
1
+ const isVisible = ( element : HTMLElement ) => {
2
+ const rect = element . getBoundingClientRect ( )
3
+ return (
4
+ rect . top >= 0 &&
5
+ rect . left >= 0 &&
6
+ rect . bottom <= ( window . innerHeight || document . documentElement . clientHeight ) &&
7
+ rect . right <= ( window . innerWidth || document . documentElement . clientWidth )
8
+ )
9
+ }
10
+
11
+ export default isVisible
You can’t perform that action at this time.
0 commit comments