Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Tailwind CSS #161

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
v20
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
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import configReactJSXRuntime from 'eslint-plugin-react/configs/jsx-runtime.js';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import {fixupPluginRules} from '@eslint/compat';
import configPrettierRecommended from 'eslint-plugin-prettier/recommended';
import tailwindPlugin from 'eslint-plugin-tailwindcss';

export default [
eslint.configs.recommended,
...eslintTS.configs.recommended,
...eslintTS.configs.stylistic,
...tailwindPlugin.configs['flat/recommended'],
configReactRecommended,
configReactJSXRuntime,
configPrettierRecommended,
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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"eslint-plugin-react-refresh": "0.4.14",
"eslint-plugin-ssr-friendly": "1.3.0",
"eslint-plugin-storybook": "0.11.0",
"eslint-plugin-tailwindcss": "3.17.5",
"generate-react-cli": "8.4.9",
"husky": "9.1.6",
"identity-obj-proxy": "3.0.0",
Expand All @@ -110,6 +111,7 @@
"stylelint-config-standard": "36.0.1",
"stylelint-order": "6.0.4",
"stylelint-prettier": "5.0.2",
"tailwindcss": "3.4.14",
"ts-jest": "29.2.5",
"ts-node": "10.9.2",
"typescript": "5.6.3",
Expand Down
501 changes: 426 additions & 75 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 @@ -21,9 +20,12 @@ export const Counter: FC<Props> = ({initialValue = 0}) => {
}, []);

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
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({})],
},
},
});