-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
5,349 additions
and
216 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
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 |
---|---|---|
|
@@ -47,3 +47,5 @@ yalc.lock | |
.swc/ | ||
|
||
stats.html | ||
|
||
*storybook.log |
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 type { StorybookConfig } from "@storybook/react-webpack5"; | ||
const path = require("path"); | ||
|
||
const config: StorybookConfig = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-webpack5-compiler-swc", | ||
"@storybook/addon-onboarding", | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@chromatic-com/storybook", | ||
"@storybook/addon-interactions", | ||
"@storybook/addon-styling-webpack", | ||
{ | ||
name: "@storybook/addon-styling-webpack", | ||
|
||
options: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
sideEffects: true, | ||
use: [ | ||
require.resolve("style-loader"), | ||
{ | ||
loader: require.resolve("css-loader"), | ||
options: { | ||
importLoaders: 1, | ||
}, | ||
}, | ||
{ | ||
loader: require.resolve("postcss-loader"), | ||
options: { | ||
implementation: require.resolve("postcss"), | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
framework: { | ||
name: "@storybook/react-webpack5", | ||
options: {}, | ||
}, | ||
webpackFinal: async (config, { configType }) => { | ||
config.resolve.alias = { | ||
...config.resolve.alias, | ||
"#/components": path.resolve(__dirname, "../src/components"), | ||
"#/lib": path.resolve(__dirname, "../src/lib"), | ||
"#/hooks": path.resolve(__dirname, "../src/hooks"), | ||
"#/locales": path.resolve(__dirname, "../src/locales"), | ||
"#/types": path.resolve(__dirname, "../src/types"), | ||
}; | ||
|
||
return config; | ||
}, | ||
}; | ||
export default config; |
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,15 @@ | ||
import type { Preview } from "@storybook/react"; | ||
import "../src/storybook.css"; | ||
import "tailwindcss/tailwind.css"; | ||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
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
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,41 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import React from "react"; | ||
import { Avatar, AvatarFallback, AvatarImage } from "../components/ui/Avatar"; | ||
|
||
// meta | ||
const meta = { | ||
title: "Components/Avatar", | ||
render: () => ( | ||
<Avatar> | ||
<AvatarImage src="https://github.com/bleu.png" alt="avatar" /> | ||
<AvatarFallback>Bleu Builders</AvatarFallback> | ||
</Avatar> | ||
), | ||
tags: ["autodocs"], | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
} satisfies Meta<{}>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const AvatarWithImage: Story = { | ||
args: {}, | ||
render: () => ( | ||
<Avatar> | ||
<AvatarImage src="https://github.com/bleu.png" alt="avatar" /> | ||
<AvatarFallback>Avatar</AvatarFallback> | ||
</Avatar> | ||
), | ||
}; | ||
export const AvatarWithFallback: Story = { | ||
args: {}, | ||
render: () => ( | ||
<Avatar> | ||
<AvatarImage src="" alt="avatar" /> | ||
<AvatarFallback>bleu</AvatarFallback> | ||
</Avatar> | ||
), | ||
}; |
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,105 @@ | ||
import React from "react"; | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { Badge, BadgeProps } from "../components/ui/Badge"; | ||
// meta | ||
const meta = { | ||
title: "Components/Badge", | ||
render: (args) => <Badge {...args}>{args.children}</Badge>, | ||
tags: ["autodocs"], | ||
args: { | ||
color: "primary", | ||
outline: "none", | ||
size: "md", | ||
children: "text", | ||
}, | ||
argTypes: { | ||
color: { | ||
control: { type: "select" }, | ||
options: ["primary", "secondary", "success", "destructive", "pending"], | ||
}, | ||
outline: { | ||
control: { type: "select" }, | ||
options: ["none", "outline"], | ||
}, | ||
size: { | ||
control: { type: "select" }, | ||
options: ["xs", "sm", "md", "lg"], | ||
}, | ||
}, | ||
|
||
parameters: { | ||
layout: "centered", | ||
}, | ||
} satisfies Meta<BadgeProps>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
// colors | ||
export const Default: Story = { | ||
args: { | ||
color: "primary", | ||
}, | ||
}; | ||
export const Secondary: Story = { | ||
args: { | ||
color: "secondary", | ||
}, | ||
}; | ||
|
||
export const Destructive: Story = { | ||
args: { | ||
color: "destructive", | ||
}, | ||
}; | ||
|
||
export const Pending: Story = { | ||
args: { | ||
color: "pending", | ||
}, | ||
}; | ||
|
||
// sizes | ||
|
||
export const Xs: Story = { | ||
args: { | ||
size: "xs", | ||
}, | ||
}; | ||
|
||
export const Sm: Story = { | ||
args: { | ||
size: "sm", | ||
}, | ||
}; | ||
|
||
export const Md: Story = { | ||
args: { | ||
size: "md", | ||
}, | ||
}; | ||
|
||
export const Lg: Story = { | ||
args: { | ||
size: "lg", | ||
}, | ||
}; | ||
|
||
// outline | ||
|
||
export const OutlineBadge: Story = { | ||
args: { | ||
outline: "outline", | ||
}, | ||
}; | ||
|
||
// link | ||
|
||
export const LinkWithStyleBadge: Story = { | ||
render: ({ color, outline, size, children }) => ( | ||
<Badge color={color} outline={outline} size={size}> | ||
{children} | ||
</Badge> | ||
), | ||
}; |
Oops, something went wrong.