Skip to content

Commit

Permalink
Storybook (#1332)
Browse files Browse the repository at this point in the history
* feat: configure storybook and add a basic button story

* fine-tune button variants, rename accent variant to secondary

* feat(Button): add loading state

* feat: add font-related classes to storybook previews

* feat: add `destructive-ghost` variant
  • Loading branch information
BrickheadJohnny authored Jun 29, 2024
1 parent 7edc914 commit d8d321d
Show file tree
Hide file tree
Showing 13 changed files with 7,900 additions and 553 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ yarn-error.log*
cypress/screenshots
cypress/videos

.idea
.idea
*storybook.log
storybook-static
24 changes: 24 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { StorybookConfig } from "@storybook/nextjs"

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
"@storybook/addon-themes",
],
framework: {
name: "@storybook/nextjs",
options: {},
},
staticDirs: ["../public"],
refs: {
"@chakra-ui/react": {
disable: true,
},
},
}
export default config
31 changes: 31 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { Preview } from "@storybook/react"
import "../src/app/globals.css"
import { dystopian, inter } from "../src/fonts"

import { withThemeByDataAttribute } from "@storybook/addon-themes"

document?.querySelector("body")?.classList.add(inter.variable, dystopian.variable)

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},

decorators: [
withThemeByDataAttribute({
themes: {
light: "",
dark: "dark",
},
defaultTheme: "light",
attributeName: "data-theme",
}),
],
}

export default preview
Loading

0 comments on commit d8d321d

Please sign in to comment.