diff --git a/packages/react-material-ui/src/components/Drawer/Drawer.tsx b/packages/react-material-ui/src/components/Drawer/Drawer.tsx index 6d1783e1..0f01e35d 100644 --- a/packages/react-material-ui/src/components/Drawer/Drawer.tsx +++ b/packages/react-material-ui/src/components/Drawer/Drawer.tsx @@ -123,95 +123,93 @@ export const Drawer = (props: DrawerProps) => { return logo; }, [logo, _collapsed]); - const drawerContent = useCallback( - (hideToggle?: boolean) => ( - + const drawerContent = (hideToggle?: boolean) => ( + + + {renderLogo()} + + + {items?.map((item, i) => { + const isActive = !!currentId && currentId.startsWith(item.id); + if (item.component) + return ( + + {typeof item.component === 'function' + ? item.component( + !!currentId && currentId.startsWith(item.id), + _collapsed, + ) + : item.component} + + ); + + return ( + + ); + })} + + {!hideToggle && + collapsible && + !!customToggle && + customToggle(toggleDrawer, _collapsed)} + + {!hideToggle && collapsible && !customToggle && ( - {renderLogo()} - - - {items?.map((item, i) => { - const isActive = !!currentId && currentId.startsWith(item.id); - if (item.component) - return ( - - {typeof item.component === 'function' - ? item.component( - !!currentId && currentId.startsWith(item.id), - _collapsed, - ) - : item.component} - - ); - - return ( - - ); - })} - - {!hideToggle && - collapsible && - !!customToggle && - customToggle(toggleDrawer, _collapsed)} - - {!hideToggle && collapsible && !customToggle && ( - - - {collapsibleIcon && - typeof collapsibleIcon === 'function' && - collapsibleIcon(_collapsed)} + {collapsibleIcon && + typeof collapsibleIcon === 'function' && + collapsibleIcon(_collapsed)} - {collapsibleIcon && - typeof collapsibleIcon != 'function' && - collapsibleIcon} + {collapsibleIcon && + typeof collapsibleIcon != 'function' && + collapsibleIcon} - {!collapsibleIcon && - (_collapsed ? : )} - - - )} - - ), - [_collapsed, mobileIsOpen], + {!collapsibleIcon && + (_collapsed ? : )} + + + )} + ); + return ( <>