Skip to content

Commit

Permalink
chore: bump storybook (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
pluvrt authored May 12, 2024
1 parent 2753045 commit 442dcee
Show file tree
Hide file tree
Showing 31 changed files with 1,656 additions and 2,761 deletions.
30 changes: 9 additions & 21 deletions apps/storybook/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
const path = require("path");

module.exports = {
stories: [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
const config = {
stories: [path.join(__dirname, "../src/**/*.stories.@(js|jsx|ts|tsx)")],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/addon-themes",
],
framework: {
name: "@storybook/nextjs",
options: {
nextConfigPath: path.resolve(__dirname, "../next.config.mjs"),
},
framework: "@storybook/nextjs",
docs: {
autodocs: "tag",
},
staticDirs: ["../public"],
webpackFinal: async (config) => {
config.resolve.fallback = {
crypto: require.resolve("crypto-browserify"),
path: require.resolve("path-browserify"),
stream: require.resolve("stream-browserify"),
url: require.resolve("url/"),
};

return config;
},
};

export default config;
4 changes: 3 additions & 1 deletion apps/storybook/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
href="https://fonts.googleapis.com/css2?family=Inconsolata&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="tailwind.css" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Source+Code+Pro:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap" rel="stylesheet" />
84 changes: 0 additions & 84 deletions apps/storybook/.storybook/preview.js

This file was deleted.

94 changes: 94 additions & 0 deletions apps/storybook/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { LaserWaveTheme } from "@pluv-internal/react-code";
import { LazyMotion } from "@pluv-internal/react-components";
import { withThemeByClassName } from "@storybook/addon-themes";
import type { Preview } from "@storybook/react";
import React, { type ComponentType } from "react";

const DEFAULT_VIEWPORT_HEIGHT = "1200px";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
viewport: {
viewports: {
"2xs": {
name: "2xs",
styles: {
width: "360px",
height: "640px",
},
},
xs: {
name: "xs",
styles: {
width: "475px",
height: "800px",
},
},
sm: {
name: "sm",
styles: {
width: "640px",
height: "960px",
},
},
md: {
name: "md",
styles: {
width: "768px",
height: "1024px",
},
},
lg: {
name: "lg",
styles: {
width: "1024px",
height: DEFAULT_VIEWPORT_HEIGHT,
},
},
xl: {
name: "xl",
styles: {
width: "1280px",
height: DEFAULT_VIEWPORT_HEIGHT,
},
},
"2xl": {
name: "2xl",
styles: {
width: "1536px",
height: DEFAULT_VIEWPORT_HEIGHT,
},
},
},
},
},
decorators: [
(Story: ComponentType) => {
return (
<>
<LaserWaveTheme />
<LazyMotion>
<Story />
</LazyMotion>
</>
);
},
withThemeByClassName({
themes: {
// nameOfTheme: 'classNameForTheme',
light: "",
dark: "dark",
},
defaultTheme: "light",
}),
],
};

export default preview;
16 changes: 3 additions & 13 deletions apps/storybook/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
module.exports = {
"presets": [
["next/babel", {
"preset-react": {
"runtime": "automatic"
}
}]
],
"plugins": [
"macros",
["styled-components", {
"ssr": true
}]
]
sourceType: "unambiguous",
presets: [["@babel/preset-env", { targets: { chrome: 100 } }], "@babel/preset-react"],
plugins: ["macros", ["styled-components", { ssr: true }]],
};
31 changes: 11 additions & 20 deletions apps/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
"description": "",
"main": "index.js",
"scripts": {
"dev": "concurrently \"pnpm:watch:*\"",
"build": "pnpm build:css && pnpm build:css",
"build:storybook": "storybook build",
"build:css": "tailwindcss -i ./src/styles/tailwind.css -o ./public/tailwind.css",
"watch:css": "pnpm build:css -- --watch",
"watch:storybook": "storybook dev -p 6006"
"build-storybook": "storybook build",
"lint": "eslint ./src/**/*.ts* --fix",
"storybook": "storybook dev -p 6006",
"tsc:check": "tsc --noEmit"
},
"keywords": [],
"author": "",
Expand All @@ -21,6 +19,7 @@
"@pluv-internal/react-chess": "workspace:^",
"@pluv-internal/react-code": "workspace:^",
"@pluv-internal/react-components": "workspace:^",
"@pluv/crdt-yjs": "workspace:^",
"@pluv/react": "workspace:^",
"@types/common-tags": "^1.8.4",
"@types/ms": "^0.7.34",
Expand All @@ -42,33 +41,25 @@
"@pluv-internal/tailwind-config": "workspace:^",
"@pluv-internal/typings": "workspace:^",
"@pluv/tsconfig": "workspace:^",
"@storybook/addon-actions": "^7.6.17",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",
"@storybook/addon-links": "^7.6.17",
"@storybook/nextjs": "^7.6.17",
"@storybook/react": "^7.6.17",
"@storybook/testing-library": "^0.2.2",
"@storybook/types": "^7.6.17",
"@storybook/addon-essentials": "^8.0.10",
"@storybook/addon-interactions": "^8.0.10",
"@storybook/addon-themes": "^8.0.10",
"@storybook/nextjs": "^8.0.10",
"@storybook/react": "^8.0.10",
"autoprefixer": "^10.4.19",
"babel-loader": "^9.1.3",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-styled-components": "^2.1.4",
"babel-plugin-twin": "^1.1.0",
"concurrently": "^8.2.2",
"crypto-browserify": "^3.12.0",
"eslint": "^8.57.0",
"eslint-config-pluv": "workspace:^",
"next-compose-plugins": "^2.2.1",
"path-browserify": "^1.0.1",
"postcss": "^8.4.38",
"react-is": "^18.3.1",
"remark-gfm": "^4.0.0",
"storybook": "^7.6.17",
"stream-browserify": "^3.0.0",
"storybook": "^8.0.10",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5",
"url": "^0.11.3",
"webpack": "^5.91.0"
},
"babelMacros": {
Expand Down
10 changes: 4 additions & 6 deletions apps/storybook/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {
config: "./tailwind.config.js"
},
autoprefixer: {},
},
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
6 changes: 4 additions & 2 deletions apps/storybook/src/react-chess/ChessBoard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import type { ChessBoardProps } from "@pluv-internal/react-chess";
import { ChessBoard } from "@pluv-internal/react-chess";
import type { Meta, StoryObj } from "@storybook/react";

export default {
const meta: Meta<typeof ChessBoard> = {
title: "react-chess/ChessBoard",
component: ChessBoard,
} as Meta;
};

export default meta;

type Story = StoryObj<ChessBoardProps>;

Expand Down
6 changes: 4 additions & 2 deletions apps/storybook/src/react-chess/LoadingChessBoard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import type { Meta, StoryObj } from "@storybook/react";
import type { LoadingChessBoardProps } from "@pluv-internal/react-chess";
import { LoadingChessBoard } from "@pluv-internal/react-chess";

export default {
const meta: Meta<typeof LoadingChessBoard> = {
title: "react-chess/LoadingChessBoard",
component: LoadingChessBoard,
} as Meta;
};

export default meta;

type Story = StoryObj<LoadingChessBoardProps>;

Expand Down
8 changes: 5 additions & 3 deletions apps/storybook/src/react-code/MultiPrismCode.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";
import type { MultiPrismCodeProps } from "@pluv-internal/react-code";
import { MultiPrismCode } from "@pluv-internal/react-code";
import type { Meta, StoryObj } from "@storybook/react";
import { codeBlock } from "common-tags";

const DEFAULT_CODE = codeBlock`
Expand Down Expand Up @@ -33,10 +33,12 @@ const TAB2 = `
${DEFAULT_CODE}
`.trim();

export default {
const meta: Meta<typeof MultiPrismCode> = {
title: "react-code/MultiPrismCode",
component: MultiPrismCode,
} as Meta;
};

export default meta;

type Story = StoryObj<MultiPrismCodeProps<"File1" | "File2">>;

Expand Down
6 changes: 4 additions & 2 deletions apps/storybook/src/react-code/PrismCode.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ export const Button: FC<ButtonProps> = ({ children, className, style }) => {
};
`;

export default {
const meta: Meta<typeof PrismCode> = {
title: "react-code/PrismCode",
component: PrismCode,
} as Meta;
};

export default meta;

type Story = StoryObj<PrismCodeProps>;

Expand Down
Loading

0 comments on commit 442dcee

Please sign in to comment.