Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix storybook #401

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const glob = promisify(require('glob'))
const { viteCommonjs } = require('@originjs/vite-plugin-commonjs')

module.exports = {
stories: ['../packages/**/*.story.@(tsx|mdx)'],
stories: ['../packages/**/*.mdx', '../packages/**/*.story.@(tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-a11y',
Expand All @@ -15,6 +15,9 @@ module.exports = {
{
name: '@storybook/addon-styling',
options: {
postCss: {
implementation: require.resolve('postcss'),
},
postcssLoaderOptions: {
postcssOptions: {
config: path.resolve(__dirname, 'postcss.config.js'),
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
"@storybook/addon-a11y": "^7.4.1",
"@storybook/addon-essentials": "^7.4.1",
"@storybook/addon-interactions": "^7.4.1",
"@storybook/addon-knobs": "^7.0.2",
"@storybook/addon-links": "^7.4.1",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/addon-storysource": "^7.4.1",
"@storybook/addon-styling": "^1.3.7",
"@storybook/addon-styling-webpack": "^0.0.5",
"@storybook/blocks": "^7.4.1",
"@storybook/builder-vite": "^7.4.1",
"@storybook/builder-webpack5": "^7.4.1",
Expand All @@ -64,6 +64,7 @@
"@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"autoprefixer": "^10.4.16",
"conventional-changelog-conventionalcommits": "^4.6.3",
"esbuild": "^0.14.14",
"esbuild-jest": "^0.5.0",
Expand Down
47 changes: 19 additions & 28 deletions packages/tailwind-config/src/docs/colors/TextBgColor.story.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
import type { Story } from '../../_lib/compat'

import type { StoryObj, Meta } from '@storybook/react'
import { colors } from '.'
import { TextBgColor } from './TextBgColor'

export default {
const meta: Meta<typeof TextBgColor> = {
title: 'tailwind-config/Colors/Text bg color',
component: TextBgColor,
argTypes: {
textColorClass: {
control: {
type: 'select',
options: Object.keys(colors).map((color) => `text-${color}`),
},
defaultValue: 'text-text1',
options: Object.keys(colors).map((color) => `text-${color}`),
control: { type: 'select' },
},
bgColorClass: {
control: {
type: 'select',
options: Object.keys(colors).map((color) => `bg-${color}`),
},
defaultValue: 'bg-background1',
options: Object.keys(colors).map((color) => `bg-${color}`),
control: { type: 'select' },
},
},
}
export default meta

type Props = Readonly<{
textColorClass: string
bgColorClass: string
}>
type Story = StoryObj<typeof TextBgColor>

export const Playground: Story<Props> = ({ textColorClass, bgColorClass }) => (
<div className={`${bgColorClass} p-64 max-w-2xl`}>
<p className={`typography-20 ${textColorClass}`}>
charcoal はピクシブ株式会社のデザインシステムです。ここでは特に、Web
フロントエンドの実装に用いる npm パッケージ集のことを言います。Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Aliquam at odio bibendum nisl
mollis eleifend et quis turpis. Quisque dignissim porta justo ut
convallis.dipiscing elit.
</p>
</div>
)
export const Playground: Story = {
args: {
textColorClass: 'text-text1',
bgColorClass: 'bg-background1',
},
render: ({ bgColorClass, textColorClass }) => (
<TextBgColor bgColorClass={bgColorClass} textColorClass={textColorClass} />
),
}
20 changes: 20 additions & 0 deletions packages/tailwind-config/src/docs/colors/TextBgColor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
type Props = {
textColorClass: string
bgColorClass: string
}
export const TextBgColor: React.FC<Props> = ({
textColorClass,
bgColorClass,
}) => {
return (
<div className={`${bgColorClass} p-64 max-w-2xl`}>
<p className={`typography-20 ${textColorClass}`}>
charcoal はピクシブ株式会社のデザインシステムです。ここでは特に、Web
フロントエンドの実装に用いる npm パッケージ集のことを言います。Lorem
ipsum dolor sit amet, consectetur adipiscing elit. Aliquam at odio
bibendum nisl mollis eleifend et quis turpis. Quisque dignissim porta
justo ut convallis.dipiscing elit.
</p>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import { Colors, TextColors } from '.'

<br />

<Story name="Colors">
<Colors />
</Story>
<Colors />

<br />
<br />
Expand All @@ -22,6 +20,4 @@ import { Colors, TextColors } from '.'

<br />

<Story name="Text colors">
<TextColors />
</Story>
<TextColors />
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ import { Gradients } from '.'

<br />

<Story name="Gradients">
<Gradients />
</Story>
<Gradients />
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ import { Sizes, HalfLeading } from '.'

<br />

<Story name="Sizes">
<Sizes />
</Story>
<Sizes />

<br />

## Half leading cancellation

<br />

<Story name="Half leading">
<HalfLeading />
</Story>
<HalfLeading />
Loading