|
| 1 | +import { ListItemProps } from '@mui/material'; |
| 2 | +import { Box, ListItem } from '../../base'; |
| 3 | +import { styled } from '../../theme'; |
| 4 | +import { PanelProps } from './Panel'; |
| 5 | + |
| 6 | +export const ListHeader = styled(ListItem)(({ theme }) => ({ |
| 7 | + padding: theme.spacing(0.5, 0.5), |
| 8 | + marginBlock: theme.spacing(1), |
| 9 | + '& .MuiListItemText-primary': { |
| 10 | + fontSize: '1rem', |
| 11 | + textTransform: 'capitalize', |
| 12 | + fontWeight: 700 |
| 13 | + }, |
| 14 | + cursor: 'pointer', |
| 15 | + '&:hover': { |
| 16 | + backgroundColor: theme.palette.action.hover |
| 17 | + }, |
| 18 | + '& .MuiSvgIcon-root': { |
| 19 | + opacity: 0, |
| 20 | + transition: 'opacity 0.2s' |
| 21 | + }, |
| 22 | + '&:hover .MuiSvgIcon-root': { |
| 23 | + opacity: 1 |
| 24 | + } |
| 25 | +})); |
| 26 | + |
| 27 | +interface CustomListItemProps extends ListItemProps { |
| 28 | + isVisible: boolean; |
| 29 | +} |
| 30 | + |
| 31 | +export const StyledListItem = styled(ListItem, { |
| 32 | + shouldForwardProp: (props) => props !== 'isVisible' |
| 33 | +})<CustomListItemProps>(({ theme, isVisible }) => ({ |
| 34 | + padding: theme.spacing(0.05, 0.5), |
| 35 | + fontStyle: isVisible ? 'normal' : 'italic', |
| 36 | + overflow: 'hidden', |
| 37 | + textOverflow: 'ellipsis', |
| 38 | + whiteSpace: 'nowrap', |
| 39 | + '& .MuiSvgIcon-root': { |
| 40 | + height: 20, |
| 41 | + width: 20 |
| 42 | + }, |
| 43 | + '& .MuiListItemIcon-root': { |
| 44 | + minWidth: 0, |
| 45 | + opacity: isVisible ? 0.8 : 0.3 |
| 46 | + }, |
| 47 | + '& .MuiTypography-root': { |
| 48 | + fontSize: '0.9rem', |
| 49 | + opacity: isVisible ? 1 : 0.5 |
| 50 | + } |
| 51 | +})); |
| 52 | + |
| 53 | +export const DrawerHeader = styled('div')(({ theme }) => ({ |
| 54 | + display: 'flex', |
| 55 | + alignItems: 'center', |
| 56 | + padding: theme.spacing(4, 2), |
| 57 | + alignContent: 'stretch', |
| 58 | + justifyContent: 'space-between', |
| 59 | + cursor: 'move', |
| 60 | + background: |
| 61 | + theme.palette.mode === 'light' |
| 62 | + ? 'linear-gradient(90deg, #3B687B 0%, #507D90 100%)' |
| 63 | + : 'linear-gradient(90deg, #28353A 0%, #3D4F57 100%)', |
| 64 | + height: '3rem', |
| 65 | + flexShrink: 0 |
| 66 | +})); |
| 67 | + |
| 68 | +export const PanelBody = styled(Box)(({ theme }) => ({ |
| 69 | + padding: theme.spacing(2), |
| 70 | + backgroundColor: theme.palette.background.surfaces, |
| 71 | + overflow: 'auto', |
| 72 | + flex: 1, |
| 73 | + minHeight: 0 |
| 74 | +})); |
| 75 | + |
| 76 | +export const ResizableContent = styled('div')({ |
| 77 | + height: '100%', |
| 78 | + display: 'flex', |
| 79 | + flexDirection: 'column', |
| 80 | + minHeight: '3rem' |
| 81 | +}); |
| 82 | + |
| 83 | +export const PanelContainer = styled(Box)<{ intitialPosition: PanelProps['intitialPosition'] }>( |
| 84 | + ({ theme, intitialPosition }) => ({ |
| 85 | + borderRadius: '8px', |
| 86 | + overflow: 'hidden', |
| 87 | + flexShrink: 0, |
| 88 | + zIndex: 99999, |
| 89 | + position: 'absolute', |
| 90 | + backgroundColor: theme.palette.background.blur?.light, |
| 91 | + boxShadow: '0 4px 16px #05003812', |
| 92 | + maxHeight: '80%', |
| 93 | + display: 'flex', |
| 94 | + boxSizing: 'border-box', |
| 95 | + ...intitialPosition |
| 96 | + }) |
| 97 | +); |
| 98 | + |
| 99 | +export const DragHandle = styled('div')({ |
| 100 | + position: 'absolute', |
| 101 | + top: '-3rem', |
| 102 | + left: '50%' |
| 103 | +}); |
| 104 | + |
| 105 | +export const HeaderActionsContainer = styled('div')({ |
| 106 | + display: 'flex', |
| 107 | + gap: '1rem', |
| 108 | + justifyContent: 'flex-end', |
| 109 | + alignItems: 'center' |
| 110 | +}); |
| 111 | + |
| 112 | +export const HeaderContainer = styled('div')({ |
| 113 | + display: 'flex', |
| 114 | + justifyContent: 'end', |
| 115 | + alignItems: 'center', |
| 116 | + flex: '1' |
| 117 | +}); |
0 commit comments