Skip to content

Commit

Permalink
feat: 新增 Drawer 组件
Browse files Browse the repository at this point in the history
  • Loading branch information
xjq7 committed Oct 23, 2022
1 parent c25fd30 commit 5ca936c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
32 changes: 32 additions & 0 deletions client/src/components/Drawer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import classNames from 'classnames';
import React from 'react';
import { PropsWithChildren } from 'react';

interface Props {
Sidebar: React.FC<any>;
id: string;
className?: string;
}

function Component(props: PropsWithChildren<Props>) {
const { id, Sidebar, children, className } = props;

return (
<div className="drawer drawer-end">
<input id={id} type="checkbox" className="drawer-toggle" />
<div className="drawer-content">{children}</div>
<div className="drawer-side">
<label htmlFor={id} className="drawer-overlay"></label>
<ul
className={classNames(
'menu p-4 overflow-y-auto w-96 bg-base-100 text-base-content',
className
)}
>
<Sidebar />
</ul>
</div>
</div>
);
}
export default Component;
2 changes: 2 additions & 0 deletions client/src/components/type.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export type ISize = 'lg' | 'md' | 'sm' | 'xs';

export type Itype = 'primary' | 'secondary' | 'accent';

0 comments on commit 5ca936c

Please sign in to comment.