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

Storybookのアップデート #269

Merged
merged 12 commits into from
Jul 14, 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
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
.vercel

!.*.js
!/.storybook
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 0 additions & 13 deletions .storybook/main.js

This file was deleted.

25 changes: 25 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { StorybookConfig } from '@storybook/nextjs';
import { VanillaExtractPlugin } from '@vanilla-extract/webpack-plugin';
import { merge } from 'webpack-merge';

const config: StorybookConfig = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-a11y'],
framework: {
name: '@storybook/nextjs',
options: {},
},
docs: {
autodocs: true,
},
staticDirs: ['../public'],
core: {
builder: '@storybook/builder-webpack5',
},
webpackFinal: async (config) =>
merge(config, {
plugins: [new VanillaExtractPlugin()],
}),
};

export default config;
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 2 additions & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ArgsTable, Title } from '@storybook/addon-docs';
import 'modern-css-reset/dist/reset.min.css';
import { Parameters } from '@storybook/react';
import React from 'react';

import '../src/styles/globals.css';
import { colors } from '../src/styles/themes.css';

export const parameters = {
export const parameters: Parameters = {
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved
controls: {
hideNoControlsWarning: true,
},
Expand Down
3 changes: 0 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ const withVanillaExtract = createVanillaExtractPlugin();

const nextConfig = {
reactStrictMode: true,
eslint: {
dirs: ['src', 'public', '.storybook'],
},
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved
};

module.exports = withVanillaExtract(nextConfig);
38 changes: 18 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"fix:prettier": "prettier --write . --ignore-path .prettierignore --cache --cache-strategy content",
"lint-staged": "lint-staged",
"prepare": "husky install",
"storybook": "start-storybook -p 6006 -s ./public",
"build-storybook": "build-storybook -s public",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"pathpida": "pathpida --enableStatic --ignorePath .pathpidaignore --output src/utils/ && prettier --write 'src/utils/$path.ts'",
"icons": "svgr -d src/components/base/Icons src/assets/icons",
"images": "node src/scripts/generateImages.js",
Expand All @@ -28,34 +28,31 @@
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.43.7",
"react-hook-form": "7.43.7",
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved
"zod": "^3.21.4"
},
"devDependencies": {
"@babel/core": "^7.16.7",
"@ls-lint/ls-lint": "^2.0.0",
"@storybook/addon-a11y": "^6.5.15",
"@storybook/addon-actions": "^6.5.15",
"@storybook/addon-essentials": "^6.5.15",
"@storybook/addon-links": "^6.5.15",
"@storybook/builder-webpack5": "^6.5.15",
"@storybook/manager-webpack5": "^6.5.15",
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved
"@storybook/react": "^6.5.15",
"@storybook/addon-a11y": "^7.0.26",
"@storybook/addon-actions": "^7.0.26",
"@storybook/addon-essentials": "^7.0.26",
"@storybook/addon-links": "^7.0.26",
"@storybook/nextjs": "^7.0.26",
"@storybook/react": "^7.0.26",
"@svgr/cli": "^6.5.1",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@vanilla-extract/babel-plugin": "^1.1.4",
"@vanilla-extract/css": "^1.6.8",
"@vanilla-extract/next-plugin": "^2.0.1",
"@vanilla-extract/recipes": "^0.3.0",
"@vanilla-extract/sprinkles": "^1.5.1",
"babel-loader": "^8.2.3",
"@vanilla-extract/css": "^1.12.0",
"@vanilla-extract/next-plugin": "^2.1.3",
"@vanilla-extract/recipes": "^0.4.0",
"@vanilla-extract/sprinkles": "^1.6.1",
"@vanilla-extract/webpack-plugin": "^2.2.0",
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved
"chromatic": "^6.4.3",
"eslint": "^8.32.0",
"eslint-config-next": "13.2.4",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-storybook": "^0.6.10",
"eslint-plugin-storybook": "^0.6.12",
"git-cz": "^4.9.0",
"husky": "^7.0.0",
"lighthouse": "^10.3.0",
Expand All @@ -65,8 +62,9 @@
"pathpida": "^0.20.1",
"prettier": "^2.8.3",
"sharp": "^0.32.1",
"storybook-addon-next": "^1.7.1",
"typescript": "4.9.5"
"storybook": "^7.0.26",
"typescript": "4.9.5",
"webpack-merge": "^5.9.0"
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved
},
"engines": {
"node": "18.15.0"
Expand Down
14 changes: 8 additions & 6 deletions src/components/base/Badge/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { ComponentMeta, Story } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react';
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved

import { Badge as BaseBadge } from '.';

export default {
const meta: Meta<typeof BaseBadge> = {
title: 'Base/Badge',
component: BaseBadge,
} as ComponentMeta<typeof BaseBadge>;
};
export default meta;
tyokinuhata marked this conversation as resolved.
Show resolved Hide resolved

export const Badge: Story = () => {
return (
type Story = StoryObj<typeof BaseBadge>;
export const Badge: Story = {
render: () => (
<dl>
<dt style={{ marginBottom: '8px' }}>color=&quot;blue&quot;</dt>
<dd style={{ marginBottom: '24px' }}>
<BaseBadge color="blue">Badge</BaseBadge>
</dd>
</dl>
);
),
};
14 changes: 8 additions & 6 deletions src/components/base/Button/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { action } from '@storybook/addon-actions';
import { ComponentMeta, Story } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react';

import { CloseIcon } from '@/components/base/Icons';

import { Button as BaseButton } from '.';

export default {
const meta: Meta<typeof BaseButton> = {
title: 'Base/Button',
component: BaseButton,
} as ComponentMeta<typeof BaseButton>;
};
export default meta;

export const Button: Story = () => {
return (
type Story = StoryObj<typeof BaseButton>;
export const Button: Story = {
render: () => (
<dl>
<dt style={{ marginBottom: '8px' }}>Default</dt>
<dd style={{ marginBottom: '24px' }}>
Expand All @@ -30,5 +32,5 @@ export const Button: Story = () => {
<CloseIcon fill="white" />
</BaseButton>
</dl>
);
),
};
14 changes: 8 additions & 6 deletions src/components/base/Heading/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { ComponentMeta, Story } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react';

import { Heading as BaseHeading } from '.';

export default {
const meta: Meta<typeof BaseHeading> = {
title: 'Base/Heading',
component: BaseHeading,
} as ComponentMeta<typeof BaseHeading>;
};
export default meta;

export const Heading: Story = () => {
return (
type Story = StoryObj<typeof BaseHeading>;
export const Heading: Story = {
render: () => (
<div>
<BaseHeading>Heading level 1</BaseHeading>
<BaseHeading tag="h2">Heading level 2</BaseHeading>
</div>
);
),
};
12 changes: 8 additions & 4 deletions src/components/base/Icons/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentMeta, Story } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react';

import * as Icons from '.';

Expand All @@ -15,9 +15,13 @@ const IconList = () => {
);
};

export default {
const meta: Meta<typeof IconList> = {
title: 'Base/Icon',
component: IconList,
} as ComponentMeta<typeof IconList>;
};
export default meta;

export const Icon: Story = () => <IconList />;
type Story = StoryObj<typeof IconList>;
export const Icon: Story = {
render: () => <IconList />,
};
14 changes: 8 additions & 6 deletions src/components/base/Image/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { ComponentMeta, Story } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react';

import { sprinkles } from '@/styles/sprinkles.css';

import { Image as BaseImage, ImageSize, ImageSource } from '.';

export default {
const meta: Meta<typeof BaseImage> = {
title: 'Base/Image',
component: BaseImage,
} as ComponentMeta<typeof BaseImage>;
};
export default meta;

type Story = StoryObj<typeof BaseImage>;
const sources: ImageSource[] = [
{
srcset: './images/zeus/zeus.avif',
Expand Down Expand Up @@ -53,8 +55,8 @@ const style = sprinkles({
backgroundColor: 'lightBlue',
});

export const Image: Story = () => {
return (
export const Image: Story = {
render: () => (
<dl>
<dt>isLazy=true</dt>
<dd style={{ marginBottom: '16px' }}>
Expand All @@ -76,5 +78,5 @@ export const Image: Story = () => {
/>
</dd>
</dl>
);
),
};
14 changes: 8 additions & 6 deletions src/components/base/Label/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { ComponentMeta, Story } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react';

import { Label as BaseLabel } from '.';

export default {
const meta: Meta<typeof BaseLabel> = {
title: 'Base/Label',
component: BaseLabel,
} as ComponentMeta<typeof BaseLabel>;
};
export default meta;

export const Label: Story = () => {
return (
type Story = StoryObj<typeof BaseLabel>;
export const Label: Story = {
render: () => (
<dl>
<dt style={{ marginBottom: '8px' }}>Default</dt>
<dd style={{ marginBottom: '24px' }}>
Expand All @@ -19,5 +21,5 @@ export const Label: Story = () => {
<BaseLabel isRequired={false}>Not required label</BaseLabel>
</dd>
</dl>
);
),
};
Loading