Skip to content

Commit

Permalink
refactor(Drawer): refactor Content
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlago99 committed Dec 2, 2024
1 parent cfbc6c2 commit 71c7b7d
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/components/designSystem/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,16 @@ export const Drawer = forwardRef<DrawerRef, DrawerProps>(
}}
/>
</div>
<Content $fullContentHeight={fullContentHeight} $withPadding={withPadding}>
<div
className={tw(
fullContentHeight && 'h-full',
withPadding && 'px-4 pb-20 pt-12 md:px-12',
)}
>
{typeof children === 'function'
? children({ closeDrawer: () => setIsOpen(false) })
: children}
</Content>
</div>

{!!stickyBottomBar && (
<div
Expand All @@ -162,16 +167,3 @@ export const Drawer = forwardRef<DrawerRef, DrawerProps>(
)

Drawer.displayName = 'Drawer'

const Content = styled.div<{ $fullContentHeight?: boolean; $withPadding?: boolean }>`
height: ${({ $fullContentHeight }) => ($fullContentHeight ? '100%' : ' ')};
padding: ${({ $withPadding }) =>
$withPadding ? `${theme.spacing(12)} ${theme.spacing(12)} ${theme.spacing(20)}` : undefined};
${theme.breakpoints.down('md')} {
padding: ${({ $withPadding }) =>
$withPadding
? `${theme.spacing(12)} ${theme.spacing(4)} ${theme.spacing(20)} ${theme.spacing(4)}`
: undefined};
}
`

0 comments on commit 71c7b7d

Please sign in to comment.