Skip to content

Commit 1dc52dc

Browse files
feat: add tailwindcss
1 parent a2ca270 commit 1dc52dc

12 files changed

Lines changed: 892 additions & 112 deletions

File tree

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// @ts-ignore
2+
3+
const path = require("path");
14
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
25

36
module.exports = {
@@ -6,6 +9,14 @@ module.exports = {
69
"../stories/**/*.stories.@(js|jsx|ts|tsx)",
710
],
811
addons: [
12+
{
13+
name: "@storybook/addon-postcss",
14+
options: {
15+
postcssLoaderOptions: {
16+
implementation: require("postcss"),
17+
},
18+
},
19+
},
920
"@storybook/addon-links",
1021
"@storybook/addon-essentials",
1122
"@storybook/addon-actions",
@@ -15,13 +26,26 @@ module.exports = {
1526
core: {
1627
builder: "@storybook/builder-webpack5",
1728
},
18-
webpackFinal: async (config) => {
29+
webpackFinal: async (config: any) => {
1930
config.resolve.plugins = [
2031
...(config.resolve.plugins || []),
2132
new TsconfigPathsPlugin({
2233
extensions: config.resolve.extensions,
2334
}),
2435
];
36+
config.module.rules.push({
37+
test: /\,css&/,
38+
use: [
39+
{
40+
loader: "postcss-loader",
41+
options: {
42+
ident: "postcss",
43+
plugins: [require("tailwindcss"), require("autoprefixer")],
44+
},
45+
},
46+
],
47+
include: path.resolve(__dirname, "../"),
48+
});
2549
return config;
2650
},
2751
};

.storybook/preview.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

.storybook/preview.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// @ts-ignore
2+
require("@styles/globals.css");
3+
4+
module.exports = {
5+
parameters: {
6+
actions: { argTypesRegex: "^on[A-Z].*" },
7+
controls: {
8+
matchers: {
9+
color: /(background|color)$/i,
10+
date: /Date$/,
11+
},
12+
},
13+
},
14+
};

components/controls/Button.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ interface ButtonProps {
66
}
77

88
const Button = ({ children, onClick }: ButtonProps) => {
9-
return <button onClick={onClick}>{children}</button>;
9+
return (
10+
<button className="bg-cyan-600" onClick={onClick}>
11+
{children}
12+
</button>
13+
);
1014
};
1115

1216
export default Button;

jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const jestConfig = {
112112
// },
113113

114114
moduleNameMapper: {
115-
"^@(components)/(.*)$": "<rootDir>/$1/$2",
115+
"^@(components|styles)/(.*)$": "<rootDir>/$1/$2",
116116
},
117117

118118
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader

0 commit comments

Comments
 (0)