parent
49b157f81b
commit
dceeae9c61
4 changed files with 36 additions and 45 deletions
@ -1,28 +1,26 @@ |
|||||||
import { FC } from 'react'; |
import { FC, useMemo } from 'react'; |
||||||
import { Box as MUIBox, BoxProps as MUIBoxProps } from '@mui/material'; |
import { Box as MUIBox, SxProps, Theme } from '@mui/material'; |
||||||
|
|
||||||
import { BORDER_RADIUS, DIVIDER } from '../../lib/consts/DEFAULT_THEME'; |
import { BORDER_RADIUS, DIVIDER } from '../../lib/consts/DEFAULT_THEME'; |
||||||
|
|
||||||
type InnerPanelProps = MUIBoxProps; |
const InnerPanel: FC<InnerPanelProps> = ({ sx, ...muiBoxRestProps }) => { |
||||||
|
const combinedSx = useMemo<SxProps<Theme>>( |
||||||
|
() => ({ |
||||||
|
borderWidth: '1px', |
||||||
|
borderRadius: BORDER_RADIUS, |
||||||
|
borderStyle: 'solid', |
||||||
|
borderColor: DIVIDER, |
||||||
|
marginTop: '1.4em', |
||||||
|
marginBottom: '1.4em', |
||||||
|
paddingBottom: 0, |
||||||
|
position: 'relative', |
||||||
|
|
||||||
const InnerPanel: FC<InnerPanelProps> = ({ sx, ...muiBoxRestProps }) => ( |
...sx, |
||||||
<MUIBox |
}), |
||||||
{...{ |
[sx], |
||||||
sx: { |
); |
||||||
borderWidth: '1px', |
|
||||||
borderRadius: BORDER_RADIUS, |
|
||||||
borderStyle: 'solid', |
|
||||||
borderColor: DIVIDER, |
|
||||||
marginTop: '1.4em', |
|
||||||
marginBottom: '1.4em', |
|
||||||
paddingBottom: 0, |
|
||||||
position: 'relative', |
|
||||||
|
|
||||||
...sx, |
return <MUIBox {...muiBoxRestProps} sx={combinedSx} />; |
||||||
}, |
}; |
||||||
...muiBoxRestProps, |
|
||||||
}} |
|
||||||
/> |
|
||||||
); |
|
||||||
|
|
||||||
export default InnerPanel; |
export default InnerPanel; |
||||||
|
@ -0,0 +1,10 @@ |
|||||||
|
type ExpandablePanelOptionalProps = { |
||||||
|
expandInitially?: boolean; |
||||||
|
loading?: boolean; |
||||||
|
panelProps?: InnerPanelProps; |
||||||
|
showHeaderSpinner?: boolean; |
||||||
|
}; |
||||||
|
|
||||||
|
type ExpandablePanelProps = ExpandablePanelOptionalProps & { |
||||||
|
header: import('react').ReactNode; |
||||||
|
}; |
@ -0,0 +1 @@ |
|||||||
|
type InnerPanelProps = import('@mui/material').BoxProps; |
Loading…
Reference in new issue