File tree Expand file tree Collapse file tree 2 files changed +18
-12
lines changed
packages/gitbook/src/components/TableOfContents Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' gitbook ' : patch
3+ ---
4+
5+ Fix ToggeableLinkItem display
Original file line number Diff line number Diff line change 11'use client' ;
22
33import { Icon } from '@gitbook/icons' ;
4- import { motion } from 'motion/react' ;
4+ import { AnimatePresence , motion } from 'motion/react' ;
55import React , { useRef } from 'react' ;
66
77import { tcls } from '@/lib/tailwind' ;
@@ -180,14 +180,10 @@ function Toggler(props: {
180180const show = {
181181 opacity : 1 ,
182182 height : 'auto' ,
183- display : 'inherit' ,
184183} ;
185184const hide = {
186185 opacity : 0 ,
187186 height : 0 ,
188- transitionEnd : {
189- display : 'none' ,
190- } ,
191187} ;
192188
193189function Descendants ( props : {
@@ -196,12 +192,17 @@ function Descendants(props: {
196192} ) {
197193 const { isVisible, children } = props ;
198194 return (
199- < motion . div
200- animate = { isVisible ? show : hide }
201- initial = { isVisible ? show : hide }
202- style = { { overflow : 'hidden' } }
203- >
204- { children }
205- </ motion . div >
195+ < AnimatePresence >
196+ { isVisible ? (
197+ < motion . div
198+ initial = { hide }
199+ animate = { show }
200+ exit = { hide }
201+ className = "flex flex-col overflow-hidden"
202+ >
203+ { children }
204+ </ motion . div >
205+ ) : null }
206+ </ AnimatePresence >
206207 ) ;
207208}
You can’t perform that action at this time.
0 commit comments