File tree Expand file tree Collapse file tree 1 file changed +4
-25
lines changed
src/Shared/Components/Collapse Expand file tree Collapse file tree 1 file changed +4
-25
lines changed Original file line number Diff line number Diff line change 1
- import { useEffect , useState , useRef } from 'react'
2
-
3
1
import { CollapseProps } from './types'
4
2
5
- export const Collapse = ( { expand, onTransitionEnd, children } : CollapseProps ) => {
6
- const ref = useRef < HTMLDivElement > ( null )
7
- const [ contentHeight , setContentHeight ] = useState ( 0 )
8
-
9
- useEffect ( ( ) => {
10
- if ( ref . current ) {
11
- setContentHeight ( ref . current . clientHeight )
12
- }
13
- } , [ children ] )
14
-
15
- return (
16
- < div
17
- style = { {
18
- height : expand ? contentHeight : 0 ,
19
- transition : 'height 200ms ease-out' ,
20
- overflow : 'hidden' ,
21
- } }
22
- onTransitionEnd = { onTransitionEnd }
23
- >
24
- < div ref = { ref } > { children } </ div >
25
- </ div >
26
- )
27
- }
3
+ export const Collapse = ( { expand, children } : CollapseProps ) => (
4
+ // TODO: removed animation because of miscalculations (broken with auto editor height)
5
+ < div > { expand ? children : null } </ div >
6
+ )
You can’t perform that action at this time.
0 commit comments