-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2390 from gluestack/feat/drawer
Feat/drawer
- Loading branch information
Showing
7 changed files
with
1,420 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
example/storybook-nativewind/src/components/Drawer/Drawer.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { ComponentMeta } from '@storybook/react-native'; | ||
import Drawer from './Drawer'; | ||
|
||
const DrawerMeta: ComponentMeta<typeof Drawer> = { | ||
title: 'stories/Drawer', | ||
component: Drawer, | ||
parameters: { | ||
layout: 'fullscreen', | ||
}, | ||
// metaInfo is required for figma generation | ||
// @ts-ignore | ||
metaInfo: { | ||
componentDescription: `A Drawer component provides a slide-in panel from any screen edge, with customizable size and anchor positions, featuring smooth animations for opening and closing. It adapts dynamically based on screen dimensions.`, | ||
}, | ||
args: { | ||
size: 'sm', | ||
anchor: 'left', | ||
}, | ||
argTypes: { | ||
size: { | ||
control: 'select', | ||
options: ['sm', 'md', 'lg', 'full'], | ||
}, | ||
anchor: { | ||
control: 'select', | ||
options: ['left', 'right', 'top', 'bottom'], | ||
}, | ||
}, | ||
}; | ||
|
||
export default DrawerMeta; | ||
|
||
export { Drawer }; |
59 changes: 59 additions & 0 deletions
59
example/storybook-nativewind/src/components/Drawer/Drawer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from 'react'; | ||
import { Button, ButtonText } from '@/components/ui/button'; | ||
import { | ||
Drawer, | ||
DrawerBackdrop, | ||
DrawerBody, | ||
DrawerContent, | ||
DrawerFooter, | ||
DrawerHeader, | ||
} from '@/components/ui/drawer'; | ||
import { Heading } from '@/components/ui/heading'; | ||
import { Text } from '@/components/ui/text'; | ||
|
||
const DrawerBasic = ({ ...props }: any) => { | ||
const [showDrawer, setShowDrawer] = React.useState(false); | ||
|
||
return ( | ||
<> | ||
<Button | ||
onPress={() => { | ||
setShowDrawer(true); | ||
}} | ||
> | ||
<ButtonText>Show Drawer</ButtonText> | ||
</Button> | ||
<Drawer | ||
isOpen={showDrawer} | ||
onClose={() => { | ||
setShowDrawer(false); | ||
}} | ||
{...props} | ||
> | ||
<DrawerBackdrop /> | ||
<DrawerContent> | ||
<DrawerHeader> | ||
<Heading size="3xl">Heading</Heading> | ||
</DrawerHeader> | ||
<DrawerBody> | ||
<Text size="2xl" className="text-typography-800"> | ||
This is a sentence. | ||
</Text> | ||
</DrawerBody> | ||
<DrawerFooter> | ||
<Button | ||
onPress={() => { | ||
setShowDrawer(false); | ||
}} | ||
className="flex-1" | ||
> | ||
<ButtonText>Button</ButtonText> | ||
</Button> | ||
</DrawerFooter> | ||
</DrawerContent> | ||
</Drawer> | ||
</> | ||
); | ||
}; | ||
|
||
export default DrawerBasic; |
Oops, something went wrong.