|
| 1 | +import { Meta, StoryObj } from '@storybook/react'; |
| 2 | +import { Button } from '../button'; |
| 3 | +import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '../card'; |
| 4 | +import { Input } from '../input'; |
| 5 | +import { Label } from '../label'; |
| 6 | +import { Tabs, TabsContent, TabsList, TabsTrigger } from '../tabs'; |
| 7 | +function TabsDemo() { |
| 8 | + return ( |
| 9 | + <Tabs |
| 10 | + defaultValue='account' |
| 11 | + className='w-[400px]' |
| 12 | + > |
| 13 | + <TabsList className='grid w-full grid-cols-2'> |
| 14 | + <TabsTrigger value='account'>Account</TabsTrigger> |
| 15 | + <TabsTrigger value='password'>Password</TabsTrigger> |
| 16 | + </TabsList> |
| 17 | + <TabsContent value='account'> |
| 18 | + <Card> |
| 19 | + <CardHeader> |
| 20 | + <CardTitle>Account</CardTitle> |
| 21 | + <CardDescription>Make changes to your account here. Click save when you're done.</CardDescription> |
| 22 | + </CardHeader> |
| 23 | + <CardContent className='space-y-2'> |
| 24 | + <div className='space-y-1'> |
| 25 | + <Label htmlFor='name'>Name</Label> |
| 26 | + <Input |
| 27 | + id='name' |
| 28 | + defaultValue='Pedro Duarte' |
| 29 | + /> |
| 30 | + </div> |
| 31 | + <div className='space-y-1'> |
| 32 | + <Label htmlFor='username'>Username</Label> |
| 33 | + <Input |
| 34 | + id='username' |
| 35 | + defaultValue='@peduarte' |
| 36 | + /> |
| 37 | + </div> |
| 38 | + </CardContent> |
| 39 | + <CardFooter> |
| 40 | + <Button>Save changes</Button> |
| 41 | + </CardFooter> |
| 42 | + </Card> |
| 43 | + </TabsContent> |
| 44 | + <TabsContent value='password'> |
| 45 | + <Card> |
| 46 | + <CardHeader> |
| 47 | + <CardTitle>Password</CardTitle> |
| 48 | + <CardDescription>Change your password here. After saving, you'll be logged out.</CardDescription> |
| 49 | + </CardHeader> |
| 50 | + <CardContent className='space-y-2'> |
| 51 | + <div className='space-y-1'> |
| 52 | + <Label htmlFor='current'>Current password</Label> |
| 53 | + <Input |
| 54 | + id='current' |
| 55 | + type='password' |
| 56 | + /> |
| 57 | + </div> |
| 58 | + <div className='space-y-1'> |
| 59 | + <Label htmlFor='new'>New password</Label> |
| 60 | + <Input |
| 61 | + id='new' |
| 62 | + type='password' |
| 63 | + /> |
| 64 | + </div> |
| 65 | + </CardContent> |
| 66 | + <CardFooter> |
| 67 | + <Button>Save password</Button> |
| 68 | + </CardFooter> |
| 69 | + </Card> |
| 70 | + </TabsContent> |
| 71 | + </Tabs> |
| 72 | + ); |
| 73 | +} |
| 74 | +const meta = { |
| 75 | + title: 'CODERUM/Tabs', |
| 76 | + component: TabsDemo, |
| 77 | + |
| 78 | + parameters: { |
| 79 | + // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout |
| 80 | + layout: 'centered', |
| 81 | + }, |
| 82 | +} satisfies Meta<typeof TabsDemo>; |
| 83 | +export default meta; |
| 84 | +type Story = StoryObj<typeof meta>; |
| 85 | +export const TabsExample: Story = {}; |
0 commit comments