Skip to content

Commit

Permalink
Enable Tailwind CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
morewings committed May 12, 2024
1 parent addb9c6 commit fc7eb66
Show file tree
Hide file tree
Showing 17 changed files with 481 additions and 423 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:ssr-friendly/recommended',
'plugin:tailwindcss/recommended',
'plugin:storybook/recommended',
'plugin:prettier/recommended',
],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Node.js CI

on:
pull_request:
branches: [ master ]
branches: ["master", "tailwind"]

jobs:
lint-test:
Expand Down
10 changes: 9 additions & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@
"at-rule-no-vendor-prefix": true,
"selector-no-vendor-prefix": true,
"max-nesting-depth": 3,
"selector-max-compound-selectors": 5
"selector-max-compound-selectors": 5,
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": [
"tailwind"
]
}
]
},
"plugins": [
"stylelint-order"
Expand Down
1 change: 0 additions & 1 deletion generate-react-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"withHookTest": true,
"customTemplates": {
"component": "templates/Component/TemplateName.tsx",
"style": "templates/Component/TemplateName.module.css",
"story": "templates/Component/TemplateName.stories.tsx",
"index": "templates/Component/index.ts",
"mdx": "templates/Component/TemplateName.mdx",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"eslint-plugin-react-refresh": "0.4.6",
"eslint-plugin-ssr-friendly": "1.3.0",
"eslint-plugin-storybook": "0.8.0",
"generate-react-cli": "8.4.1",
"eslint-plugin-tailwindcss": "3.15.1",
"husky": "9.0.11",
"identity-obj-proxy": "3.0.0",
"is-ci": "3.0.1",
Expand All @@ -105,6 +105,7 @@
"stylelint-config-standard": "36.0.0",
"stylelint-order": "6.0.4",
"stylelint-prettier": "5.0.0",
"tailwindcss": "3.4.3",
"ts-jest": "29.1.2",
"ts-node": "10.9.2",
"typescript": "5.4.5",
Expand Down
765 changes: 426 additions & 339 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
'postcss-preset-env': {},
},
};
33 changes: 0 additions & 33 deletions src/lib/CounterDemo/Counter.module.css

This file was deleted.

10 changes: 6 additions & 4 deletions src/lib/CounterDemo/Counter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type {FC} from 'react';
import {useEffect} from 'react';
import {throttle} from 'lodash';

import classes from './Counter.module.css';
import useLogic from './useLogic';

export type Props = {
Expand All @@ -20,9 +19,12 @@ export const Counter: FC<Props> = ({initialValue = 0}) => {
runner();
}, []);
return (
<div className={classes.counter}>
<h2 className={classes.header}>Counter</h2>
<button className={classes.button} type="button" onClick={incrementCount}>
<div className="w-60 border border-slate-300 p-6 text-center">
<h2 className="mb-3 text-2xl">Counter</h2>
<button
className="mb-6 rounded-lg bg-teal-600 px-6 py-3 text-base text-white drop-shadow-md active:relative active:left-0.5 active:top-0.5 active:drop-shadow-none"
type="button"
onClick={incrementCount}>
Increment by one
</button>
<div>
Expand Down
9 changes: 7 additions & 2 deletions src/lib/CounterDemo/__snapshots__/Counter.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

exports[`lib > Counter renders without crashing 1`] = `
<DocumentFragment>
<div>
<h2>
<div
class="w-60 border border-slate-300 p-6 text-center"
>
<h2
class="mb-3 text-2xl"
>
Counter
</h2>
<button
class="mb-6 rounded-lg bg-teal-600 px-6 py-3 text-base text-white drop-shadow-md active:relative active:left-0.5 active:top-0.5 active:drop-shadow-none"
type="button"
>
Increment by one
Expand Down
3 changes: 3 additions & 0 deletions src/lib/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
2 changes: 2 additions & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
import './index.css';

export {Counter} from './CounterDemo';
10 changes: 10 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// const defaultTheme = require('tailwindcss/defaultTheme');

/** @type {import('tailwindcss').Config} */
export default {
content: ['./index.html', './src/**/*.tsx'],
theme: {
extend: {},
},
plugins: [],
};
33 changes: 0 additions & 33 deletions templates/Component/TemplateName.module.css

This file was deleted.

10 changes: 6 additions & 4 deletions templates/Component/TemplateName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type {FC} from 'react';
import {useEffect} from 'react';
import {throttle} from 'lodash';

import classes from './TemplateName.module.css';
import useLogic from './useLogic';

export type Props = {
Expand All @@ -20,9 +19,12 @@ export const TemplateName: FC<Props> = ({initialValue = 0}) => {
runner();
}, []);
return (
<div className={classes.templateName}>
<h2 className={classes.header}>Counter</h2>
<button className={classes.button} type="button" onClick={incrementCount}>
<div className="w-60 border border-slate-300 p-6 text-center">
<h2 className="mb-3 text-2xl">Counter</h2>
<button
className="mb-6 rounded-lg bg-teal-600 px-6 py-3 text-base text-white drop-shadow-md active:relative active:left-0.5 active:top-0.5 active:drop-shadow-none"
type="button"
onClick={incrementCount}>
Increment by one
</button>
<div>
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.linter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"**/*.stories.tsx",
"**/*.stories.ts",
"*.config.ts",
"tailwind.config.js",
"postcss.config.js",
"src",
".eslintrc.cjs",
"templates/**/*.ts",
Expand Down
4 changes: 0 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import react from '@vitejs/plugin-react';
import hq from 'alias-hq';
import external from '@yelo/rollup-node-external';
import dts from 'vite-plugin-dts';
import postcssPresetEnv from 'postcss-preset-env';

// https://vitejs.dev/config/
export default defineConfig({
Expand Down Expand Up @@ -39,8 +38,5 @@ export default defineConfig({
modules: {
localsConvention: 'camelCase',
},
postcss: {
plugins: [postcssPresetEnv({})],
},
},
});

0 comments on commit fc7eb66

Please sign in to comment.