Skip to content

Commit

Permalink
feat: remove open button control in drawer component
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyotato committed Aug 10, 2024
1 parent 36379f6 commit 3ade040
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions apps/web/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export default function Home() {
</Container>
</Container>
<UnstyledLink href="/">떡볶이</UnstyledLink>
<Drawer isOpen={isOpen} toggle={toggle} close={close}>
<Drawer isOpen={isOpen} toggle={toggle} close={close} overlay={false}>
<div>show contents</div>
<div>:)</div>
</Drawer>
<MyButton onClick={open}>외부에서 open</MyButton>
<MyButton onClick={open}>토글</MyButton>
</>
);
}
11 changes: 4 additions & 7 deletions packages/design-system/src/components/drawer/_drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Style from "./_drawer.module.scss";
export type DrawerProps = {
children?: ReactNode;
overlay?: boolean;

withCloseButton?: boolean;
} & Omit<React.ComponentProps<"div">, "children"> &
Partial<useDrawerOutput>;
Expand All @@ -19,17 +20,13 @@ const Drawer = ({
overlay = true,
withCloseButton = true,
isOpen,
toggle,

close,
}: DrawerProps) => {
return (
<>
<MyButton onClick={toggle}>Open</MyButton>
{overlay && close != null ? (
<div
className={style(isOpen ? "is-open" : null)}
onClick={() => close()}
/>
{overlay ? (
<div className={style(isOpen ? "is-open" : null)} onClick={close} />
) : null}

<aside className={style("drawer-menu", !isOpen && "is-closed")}>
Expand Down

0 comments on commit 3ade040

Please sign in to comment.