File size: 1,726 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
import React, { ComponentType, PropsWithChildren } from 'react'
import { Box, BoxProps, Drawer, DrawerContent, DrawerFooter } from '@adminjs/design-system'
import { styled } from '@adminjs/design-system/styled-components'
import allowOverride from '../../../hoc/allow-override.js'
const StyledWrapperWithFilter = styled(Box)`
& > ${Drawer} {
border-radius: ${({ theme }) => theme.space.sm};
}
& > ${DrawerContent} {
background: ${({ theme }) => theme.colors.container};
padding: ${({ theme }) => theme.space.xxl};
overflow: visible;
}
& > ${DrawerFooter} {
background: ${({ theme }) => theme.colors.container};
padding: 0 ${({ theme }) => theme.space.xxl} ${({ theme }) => theme.space.xxl};
}
`
const StyledWrapper = styled(Box)`
& ${DrawerContent} {
background: ${({ theme }) => theme.colors.container};
padding: ${({ theme }) => theme.space.xxl};
overflow: visible;
}
& ${DrawerFooter} {
background: ${({ theme }) => theme.colors.container};
padding: 0 ${({ theme }) => theme.space.xxl} ${({ theme }) => theme.space.xxl};
}
`
type WrapperProps = BoxProps & {
showFilter?: boolean;
children?: React.ReactNode;
}
const Wrapper: React.FC<WrapperProps> = (props) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { children, variant, color, showFilter = false, 'data-css': dataCss, ...rest } = props
const Component: ComponentType<PropsWithChildren<any>> = showFilter
? StyledWrapperWithFilter
: StyledWrapper
return (
<Component {...rest} variant="transparent" mx="auto" data-css={dataCss || 'styled-wrapper'}>
{children}
</Component>
)
}
export default allowOverride(Wrapper, 'RouteWrapper')
|