Skip to content

Commit

Permalink
feat: add Drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Seidel authored and spawnia committed Mar 15, 2024
1 parent c36e08d commit 6d37120
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Drawer/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { StoryFn } from '@storybook/react';
import React, { useState } from 'react';

import { Button } from '../Button';

import { Drawer, DrawerProps } from './index';

export default {
title: 'Drawer',
};

export const Default: StoryFn<DrawerProps> = function Default(args) {
const [visible, setVisible] = useState(true);

const toggleDrawer = () => setVisible((prevState) => !prevState);

return (
<div>
<Button onClick={toggleDrawer}>Open</Button>
<Drawer title="Title" onClose={toggleDrawer} visible={visible} {...args}>
Content
</Drawer>
</div>
);
};
4 changes: 4 additions & 0 deletions src/Drawer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Drawer as AntdDrawer, DrawerProps as AntdDrawerProps } from 'antd';

export const Drawer: typeof AntdDrawer = AntdDrawer;
export type DrawerProps = AntdDrawerProps;
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export * from './Comment';
export * from './DatePicker';
export * from './Descriptions';
export * from './Divider';
export * from './Drawer';
export * from './Dropdown';
export * from './Empty';
export * from './Fields'; // Might extract to separate package later due to dependency on react-hook-form
Expand Down

0 comments on commit 6d37120

Please sign in to comment.