Skip to content

Commit cb02ebb

Browse files
committed
feat: add storybook and animated planet component
1 parent 3fc26d8 commit cb02ebb

22 files changed

+15321
-5486
lines changed

.github/workflows/checks.yml

+24
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,27 @@ jobs:
2727
cache: "npm"
2828
- run: npm ci
2929
- run: npm test
30+
31+
build-storybook:
32+
runs-on: ubuntu-latest
33+
34+
strategy:
35+
matrix:
36+
node-version: [20.x]
37+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
- name: Use Node.js ${{ matrix.node-version }}
42+
uses: actions/setup-node@v2
43+
with:
44+
node-version: ${{ matrix.node-version }}
45+
cache: "npm"
46+
- run: npm ci
47+
- run: npm run build-storybook
48+
- name: Save storybook static
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: storybook static
52+
path: |
53+
storybook-static

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.docusaurus
99
.cache-loader
1010
.idea
11+
.eslintcache
1112

1213
# Misc
1314
.DS_Store
@@ -17,3 +18,7 @@
1718
.env.production.local
1819

1920
npm-debug.log*
21+
22+
*storybook.log
23+
storybook-static
24+
tmp

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ build
44
LICENSE
55
package.json
66
package-lock.json
7+
storybook-static
8+
build
9+
tmp

.storybook/main.ts

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import * as path from "path";
2+
import { fileURLToPath } from "url";
3+
import type { StorybookConfig } from "@storybook/react-webpack5";
4+
5+
const config: StorybookConfig = {
6+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
7+
addons: [
8+
"@storybook/addon-webpack5-compiler-swc",
9+
"@storybook/addon-onboarding",
10+
"@storybook/addon-links",
11+
"@storybook/addon-essentials",
12+
"@chromatic-com/storybook",
13+
"@storybook/addon-interactions",
14+
],
15+
framework: {
16+
name: "@storybook/react-webpack5",
17+
options: {},
18+
},
19+
docs: {
20+
autodocs: "tag",
21+
},
22+
swc: () => ({
23+
jsc: {
24+
transform: {
25+
react: {
26+
runtime: "automatic",
27+
},
28+
},
29+
},
30+
}),
31+
webpackFinal: config => {
32+
return {
33+
...config,
34+
resolve: {
35+
...config.resolve,
36+
alias: {
37+
...config.resolve?.alias,
38+
"@site": path.resolve(fileURLToPath(import.meta.url), "../.."),
39+
},
40+
},
41+
module: {
42+
...config.module,
43+
rules: [
44+
...(config.module?.rules as Record<string, any>[]),
45+
{
46+
test: /\.(sa|sc|c)ss$/, // Test for .sass, .scss and .css files
47+
use: [
48+
// MiniCssExtractPlugin.loader, // Extract css into separate files
49+
"style-loader",
50+
"css-loader", // Translates CSS into CommonJS
51+
{
52+
loader: "postcss-loader", // Loader for webpack to process CSS with PostCSS
53+
options: {
54+
postcssOptions: {
55+
ident: "postcss",
56+
plugins: [
57+
require("postcss-import"),
58+
require("tailwindcss"), // use tailwindcss
59+
require("autoprefixer"), // add vendor prefixes
60+
],
61+
},
62+
},
63+
},
64+
"sass-loader", // Compiles Sass to CSS
65+
],
66+
},
67+
],
68+
},
69+
};
70+
},
71+
};
72+
export default config;

.storybook/preview.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { Preview } from "@storybook/react";
2+
3+
import "../src/scss/custom.scss";
4+
5+
const preview: Preview = {
6+
parameters: {
7+
controls: {
8+
matchers: {
9+
color: /(background|color)$/i,
10+
date: /Date$/i,
11+
},
12+
},
13+
},
14+
};
15+
16+
export default preview;

eslint.config.mjs

+12-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,19 @@ import tseslint from "typescript-eslint";
77

88
export default tseslint.config(
99
{
10-
ignores: ["node_modules/**", ".docusaurus/**", "babel.config.js", "eslint.config.mjs"],
10+
ignores: [
11+
"node_modules/**",
12+
".docusaurus/**",
13+
"babel.config.js",
14+
"eslint.config.mjs",
15+
"storybook-static/**",
16+
"build/**",
17+
"tmp/**",
18+
],
1119
},
20+
eslint.configs.recommended,
21+
...tseslint.configs.recommendedTypeChecked,
22+
...tseslint.configs.stylisticTypeChecked,
1223
{
1324
files: ["plugins/tailwind.ts"],
1425
languageOptions: {
@@ -17,9 +28,6 @@ export default tseslint.config(
1728
},
1829
},
1930
},
20-
eslint.configs.recommended,
21-
...tseslint.configs.recommendedTypeChecked,
22-
...tseslint.configs.stylisticTypeChecked,
2331
{
2432
languageOptions: {
2533
parserOptions: {

0 commit comments

Comments
 (0)