Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: Add storybook + initial story#118

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bryphe-coder merged 7 commits intomainfrombryphe/refactor/add-storybook
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
3 changes: 3 additions & 0 deletions.github/workflows/coder.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -198,6 +198,9 @@ jobs:
- run: yarn build
working-directory: site

- run: yarn storybook:build
working-directory: site

- run: yarn test:coverage
working-directory: site

Expand Down
1 change: 1 addition & 0 deletions.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,7 @@ yarn-error.log
site/.eslintcache
site/.next/
site/node_modules/
site/storybook-static/
site/yarn-error.log
coverage/

Expand Down
3 changes: 2 additions & 1 deletionsite/.eslintignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,4 +5,5 @@ node_modules
vendor
out
coverage
.next
.next
storybook-static
1 change: 1 addition & 0 deletionssite/.prettierignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,3 +14,4 @@ yarn-error.log
.next/
coverage/
out/
storybook-static/
16 changes: 16 additions & 0 deletionssite/.storybook/main.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
const path = require("path")

module.exports = {
stories: ["../**/*.stories.mdx", "../**/*.stories.@(js|jsx|ts|tsx)"],
addons: ["@storybook/addon-links", "@storybook/addon-essentials"],
babel: async (options) => ({
...options,
plugins: ["@babel/plugin-proposal-class-properties"],
// any extra options you want to set
}),
webpackFinal: async (config) => {
config.resolve.modules = [path.resolve(__dirname, ".."), "node_modules"]

return config
},
}
20 changes: 20 additions & 0 deletionssite/.storybook/preview.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
import ThemeProvider from "@material-ui/styles/ThemeProvider"
import { withThemes } from "@react-theming/storybook-addon"
import { light, dark } from "../theme"
import { addDecorator } from "node_modules/@storybook/react"

addDecorator(withThemes(ThemeProvider, [light, dark]))

export const parameters = {
actions: {
argTypesRegex: "^on[A-Z].*",
argTypesRegex: "^handle[A-Z].*",
},
controls: {
expanded: true,
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
26 changes: 26 additions & 0 deletionssite/components/Button/LoadingButton.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
import { Story } from "@storybook/react"
import React from "react"
import { LoadingButton, LoadingButtonProps } from "./LoadingButton"

export default {
title: "Button/LoadingButton",
component: LoadingButton,
argTypes: {
loading: { control: { type: "boolean" } },
children: { control: "text", defaultValue: "Create workspace" },
},
}

const Template: Story<LoadingButtonProps> = (args) => <LoadingButton {...args} />

export const Loading = Template.bind({})
Loading.args = {
variant: "contained",
loading: true,
}

export const NotLoading = Template.bind({})
NotLoading.args = {
variant: "contained",
loading: false,
}
1 change: 1 addition & 0 deletionssite/jest.config.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,5 +41,6 @@ module.exports = {
"!<rootDir>/next-env.d.ts",
"!<rootDir>/next.config.js",
"!<rootDir>/out/**/*.*",
"!<rootDir>/storybook-static/**/*.*",
],
}
7 changes: 7 additions & 0 deletionssite/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,20 @@
"format:write": "prettier --write '**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}' && sql-formatter -l postgresql ./database/query.sql -o ./database/query.sql",
"lint": "jest --selectProjects lint",
"lint:fix": "FIX=true yarn lint",
"storybook": "start-storybook -p 6006 -s ./static",
"storybook:build": "build-storybook",
"test": "jest --selectProjects test",
"test:coverage": "jest --selectProjects test --collectCoverage"
},
"devDependencies": {
"@material-ui/core": "4.9.4",
"@material-ui/icons": "4.5.1",
"@material-ui/lab": "4.0.0-alpha.42",
"@react-theming/storybook-addon": "1.1.3",
"@storybook/addon-actions": "6.3.12",
"@storybook/addon-essentials": "6.3.12",
"@storybook/addon-links": "6.3.12",
"@storybook/react": "6.3.12",
"@testing-library/react": "12.1.2",
"@types/express": "4.17.13",
"@types/jest": "27.4.0",
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp