diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/TableDetailDrawer/TableDetailDrawer.module.css b/frontend/packages/erd-core/src/components/ERDRenderer/TableDetailDrawer/TableDetailDrawer.module.css index d88852e7d..ac6cb489c 100644 --- a/frontend/packages/erd-core/src/components/ERDRenderer/TableDetailDrawer/TableDetailDrawer.module.css +++ b/frontend/packages/erd-core/src/components/ERDRenderer/TableDetailDrawer/TableDetailDrawer.module.css @@ -5,7 +5,7 @@ } .content[data-vaul-drawer] { - transition-duration: var(--drawer-animation-duration); - animation-duration: var(--drawer-animation-duration); + transition-duration: 165ms; + animation-duration: 165ms; user-select: auto; } diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/TableDetailDrawer/TableDetailDrawer.tsx b/frontend/packages/erd-core/src/components/ERDRenderer/TableDetailDrawer/TableDetailDrawer.tsx index e90a1292e..c7042819f 100644 --- a/frontend/packages/erd-core/src/components/ERDRenderer/TableDetailDrawer/TableDetailDrawer.tsx +++ b/frontend/packages/erd-core/src/components/ERDRenderer/TableDetailDrawer/TableDetailDrawer.tsx @@ -4,34 +4,17 @@ import { useUserEditingStore, } from '@/stores' import { DrawerContent, DrawerPortal, DrawerRoot } from '@liam-hq/ui' -import { - type FC, - type PropsWithChildren, - useCallback, - useEffect, - useState, -} from 'react' +import type { FC, PropsWithChildren } from 'react' // biome-ignore lint/nursery/useImportRestrictions: Fixed in the next PR. import { TableDetail } from '../ERDContent/TableNode/TableDetail' import styles from './TableDetailDrawer.module.css' -const ANIMATION_DURATION = 165 +const handleClose = () => updateActiveTableName(undefined) export const TableDetailDrawerRoot: FC = ({ children }) => { const { - active: { tableName: tableId }, + active: { tableName }, } = useUserEditingStore() - const [open, setOpen] = useState(tableId !== undefined) - - useEffect(() => { - setOpen(tableId !== undefined) - }, [tableId]) - - const handleClose = useCallback(() => { - setOpen(false) - // NOTE: Wait for the drawer to close before updating the active table name. - setTimeout(() => updateActiveTableName(undefined), ANIMATION_DURATION) - }, []) return ( = ({ children }) => { // This behavior is an undocumented, unofficial usage and might change in the future. // ref: https://github.com/emilkowalski/vaul/blob/main/src/use-snap-points.ts snapPoints={[]} - open={open} + open={tableName !== undefined} onClose={handleClose} > {children} @@ -63,11 +46,7 @@ export const TableDetailDrawer: FC = () => { return ( - + {table !== undefined && }