({children, sx})
| 29 | } |
| 30 | |
| 31 | export function CollapseSideBar({children, sx}) { |
| 32 | const smallPage = useSmallPage(); |
| 33 | const [open, setOpen] = useState(false) |
| 34 | return ( |
| 35 | <> |
| 36 | <SwipeableDrawer |
| 37 | variant={smallPage ? "temporary" : "persistent"} |
| 38 | open={!smallPage || (smallPage && open)} |
| 39 | onOpen={() => setOpen(true)} |
| 40 | onClose={() => setOpen(false)} |
| 41 | elevation={0} |
| 42 | sx={{ |
| 43 | display: "flex", |
| 44 | width: 'auto', |
| 45 | height: 'auto', |
| 46 | zIndex: (smallPage ? 1201 : 1), |
| 47 | ...sx, |
| 48 | '& .MuiDrawer-paper': { |
| 49 | borderRadius: (smallPage ? '0 18px 18px 0' : '12px'), |
| 50 | border: 'none', |
| 51 | backgroundImage: 'none', |
| 52 | position: (smallPage ? 'absolute' : 'initial'), |
| 53 | top: '60px', |
| 54 | overflowY: 'auto', |
| 55 | // flat on desktop (no 3D card shadow); on the mobile overlay |
| 56 | // drawer use a soft modern shadow to lift it off the page |
| 57 | boxShadow: (smallPage ? "0 12px 40px rgba(16,24,40,0.22)" : 'none'), |
| 58 | ...(sx['& .MuiDrawer-paper'] ?? {}) |
| 59 | }, |
| 60 | }} |
| 61 | > |
| 62 | {children} |
| 63 | </SwipeableDrawer> |
| 64 | <Button |
| 65 | className="ShowUpButton" |
| 66 | onClick={() => setOpen(!open)} |
| 67 | disableRipple |
| 68 | sx={{ |
| 69 | position: 'absolute', |
| 70 | top: '50%', |
| 71 | transform: 'translateY(-50%)', |
| 72 | visibility: smallPage ? 'visible' : 'hidden', |
| 73 | minWidth: 0, |
| 74 | p: 0, |
| 75 | width: 26, |
| 76 | height: 64, |
| 77 | borderRadius: '0 16px 16px 0', |
| 78 | bgcolor: (theme) => theme.palette.surface, |
| 79 | color: 'primary.main', |
| 80 | border: (theme) => `1px solid ${theme.palette.divider}`, |
| 81 | borderLeft: 'none', |
| 82 | boxShadow: '0 4px 16px rgba(16,24,40,0.18)', |
| 83 | transition: 'background-color 0.15s ease, padding-left 0.15s ease', |
| 84 | '&:hover': { |
| 85 | bgcolor: (theme) => theme.palette.surfaceVariant, |
| 86 | pl: '2px', |
| 87 | }, |
| 88 | zIndex: (smallPage ? 1200 : 1) |
nothing calls this directly
no test coverage detected