Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
coderz-w committed Jul 19, 2024
2 parents 2444d27 + 2cc12bc commit df89873
Show file tree
Hide file tree
Showing 7 changed files with 328 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/components/ui/avatar/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import { Meta, StoryFn } from '@storybook/react';

import { Avatar, AvatarImage, AvatarFallback } from './index';

export default {
title: 'Components/Avatar',
component: Avatar,
subcomponents: { AvatarImage, AvatarFallback },
} as Meta;

type AvatarProps = {
src: string;
alt: string;
fallback: string;
};

const Template: StoryFn<AvatarProps> = (args) => (
<Avatar>
<AvatarImage src={args.src} alt={args.alt} />
<AvatarFallback>{args.fallback}</AvatarFallback>
</Avatar>
);

export const Default = Template.bind({});
Default.args = {
src: 'https://via.placeholder.com/150',
alt: 'Avatar Image',
fallback: 'AB',
};

export const WithFallback = Template.bind({});
WithFallback.args = {
src: '',
alt: 'Avatar Image',
fallback: 'AB',
};
35 changes: 35 additions & 0 deletions src/components/ui/badge/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import { Meta, StoryFn } from '@storybook/react';

import { Badge, BadgeProps } from './index';

export default {
title: 'Components/Badge',
component: Badge,
} as Meta;

const Template: StoryFn<BadgeProps> = (args) => <Badge {...args} />;

export const Default = Template.bind({});
Default.args = {
children: 'Default Badge',
variant: 'default',
};

export const Secondary = Template.bind({});
Secondary.args = {
children: 'Secondary Badge',
variant: 'secondary',
};

export const Destructive = Template.bind({});
Destructive.args = {
children: 'Destructive Badge',
variant: 'destructive',
};

export const Outline = Template.bind({});
Outline.args = {
children: 'Outline Badge',
variant: 'outline',
};
74 changes: 74 additions & 0 deletions src/components/ui/button/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import React from 'react';
import { Meta, StoryFn } from '@storybook/react';

import { Button, ButtonProps } from './index';

export default {
title: 'Components/Button',
component: Button,
} as Meta;

const Template: StoryFn<ButtonProps> = (args) => <Button {...args} />;

export const Default = Template.bind({});
Default.args = {
children: 'Default Button',
variant: 'default',
size: 'default',
};

export const Destructive = Template.bind({});
Destructive.args = {
children: 'Destructive Button',
variant: 'destructive',
size: 'default',
};

export const Outline = Template.bind({});
Outline.args = {
children: 'Outline Button',
variant: 'outline',
size: 'default',
};

export const Secondary = Template.bind({});
Secondary.args = {
children: 'Secondary Button',
variant: 'secondary',
size: 'default',
};

export const Ghost = Template.bind({});
Ghost.args = {
children: 'Ghost Button',
variant: 'ghost',
size: 'default',
};

export const Link = Template.bind({});
Link.args = {
children: 'Link Button',
variant: 'link',
size: 'default',
};

export const Small = Template.bind({});
Small.args = {
children: 'Small Button',
variant: 'default',
size: 'sm',
};

export const Large = Template.bind({});
Large.args = {
children: 'Large Button',
variant: 'default',
size: 'lg',
};

export const Icon = Template.bind({});
Icon.args = {
children: 'Icon Button',
variant: 'default',
size: 'icon',
};
54 changes: 54 additions & 0 deletions src/components/ui/dialog/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from 'react';
import { Meta, StoryFn } from '@storybook/react';
import { Cross2Icon } from '@radix-ui/react-icons';

import {
Dialog,
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
DialogClose,
} from './index';

export default {
title: 'Components/Dialog',
component: Dialog,
subcomponents: {
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
DialogClose,
},
} as Meta;

const Template: StoryFn = () => (
<Dialog>
<DialogTrigger asChild>
<button className="p-2 bg-blue-500 text-white rounded">Open Dialog</button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Dialog Title</DialogTitle>
<DialogDescription>This is the dialog description</DialogDescription>
</DialogHeader>
<div className="mt-4">Dialog Content</div>
<DialogFooter>
<button className="p-2 bg-gray-200 rounded">Cancel</button>
<button className="p-2 bg-blue-500 text-white rounded">Confirm</button>
</DialogFooter>
<DialogClose className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<Cross2Icon className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogClose>
</DialogContent>
</Dialog>
);

export const Default = Template.bind({});
Default.args = {};
75 changes: 75 additions & 0 deletions src/components/ui/dropdown-menu/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React from 'react';
import { Meta, StoryFn } from '@storybook/react';

import {
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuCheckboxItem,
DropdownMenuRadioItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuGroup,
DropdownMenuPortal,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuRadioGroup,
} from './index';

export default {
title: 'Components/DropdownMenu',
component: DropdownMenu,
subcomponents: {
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuCheckboxItem,
DropdownMenuRadioItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuGroup,
DropdownMenuPortal,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuRadioGroup,
},
} as Meta;

const Template: StoryFn = (args) => (
<DropdownMenu {...args}>
<DropdownMenuTrigger asChild>
<button className="p-2 bg-blue-500 text-white rounded">Open Menu</button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel>Menu</DropdownMenuLabel>
<DropdownMenuItem>Item 1</DropdownMenuItem>
<DropdownMenuItem>Item 2</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuCheckboxItem checked>Checkbox Item</DropdownMenuCheckboxItem>
<DropdownMenuRadioGroup value="radio1">
<DropdownMenuRadioItem value="radio1">Radio Item 1</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="radio2">Radio Item 2</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>
<DropdownMenuSub>
<DropdownMenuSubTrigger>Sub Menu</DropdownMenuSubTrigger>
<DropdownMenuSubContent>
<DropdownMenuItem>Sub Item 1</DropdownMenuItem>
<DropdownMenuItem>Sub Item 2</DropdownMenuItem>
</DropdownMenuSubContent>
</DropdownMenuSub>
<DropdownMenuSeparator />
<DropdownMenuItem>
Item with Shortcut
<DropdownMenuShortcut>⌘S</DropdownMenuShortcut>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);

export const Default = Template.bind({});
Default.args = {};
30 changes: 30 additions & 0 deletions src/components/ui/input/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { Meta, StoryFn } from '@storybook/react';

import { Input, InputProps } from './index';

export default {
title: 'Components/Input',
component: Input,
} as Meta;

const Template: StoryFn<InputProps> = (args) => <Input {...args} />;

export const Default = Template.bind({});
Default.args = {
type: 'text',
placeholder: 'Enter text...',
};

export const Disabled = Template.bind({});
Disabled.args = {
type: 'text',
placeholder: 'Disabled input...',
disabled: true,
};

export const WithDefaultValue = Template.bind({});
WithDefaultValue.args = {
type: 'text',
defaultValue: 'Default value',
};
23 changes: 23 additions & 0 deletions src/components/ui/scroll-area/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { Meta, StoryFn } from '@storybook/react';

import { ScrollArea, ScrollBar } from './index';

export default {
title: 'Components/ScrollArea',
component: ScrollArea,
subcomponents: { ScrollBar },
} as Meta;

const Template: StoryFn = (args) => (
<div style={{ height: '200px', width: '200px' }}>
<ScrollArea {...args}>
<div style={{ height: '400px', width: '400px', backgroundColor: '#f0f0f0' }}>
This is a scrollable content area. Add more content here to see the scrollbars in action.
</div>
</ScrollArea>
</div>
);

export const Default = Template.bind({});
Default.args = {};

0 comments on commit df89873

Please sign in to comment.