File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/pages/main/components/sidebar/datasets-list/components Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
- import { FC , useRef } from 'react'
1
+ import { FC , useEffect , useRef , useState } from 'react'
2
2
import cn , { Argument } from 'classnames'
3
3
import Tooltip from 'rc-tooltip'
4
4
@@ -28,10 +28,16 @@ export const DatasetName: FC<IDsNameProps> = ({
28
28
29
29
const name = isXL && / ^ x l _ .* / i. test ( dsName ) ? dsName . substring ( 3 ) : dsName
30
30
31
- const { x = 0 , width = 0 } =
32
- datasetRef ?. current ?. getBoundingClientRect ( ) || { }
31
+ const [ hasTooltip , setHasTooltip ] = useState < boolean > ( false )
33
32
34
- const hasTooltip = width + x > 230
33
+ useEffect ( ( ) => {
34
+ const container = datasetRef ?. current
35
+ const isTooltipNeeded = container
36
+ ? container . clientWidth < container . scrollWidth
37
+ : false
38
+
39
+ setHasTooltip ( isTooltipNeeded )
40
+ } , [ ] )
35
41
36
42
const fontColor = kind === null ? 'text-grey-blue' : 'text-white'
37
43
const fontWeight = isXL
You can’t perform that action at this time.
0 commit comments