Skip to content

Commit 0b6db6a

Browse files
authored
Use Tailwind 3.0 (#515)
* upgrade to tailwind 3.0 alpha, make config changes * rewrite svg: w/ new addVariant API tailwindlabs/tailwindcss#5809 * first first-of-type:before: order issue (tw fix in next alpha) tailwindlabs/tailwindcss#6112 tailwindlabs/tailwindcss#6016 tailwindlabs/tailwindcss#6018 * replace tailwindcss-children plugin with new custom addVariant * oh yeah... use stroke-green-500 * each variant doesn't need its own plugin * update yarn.lock after merging main
1 parent 1cfbb66 commit 0b6db6a

File tree

6 files changed

+27
-167
lines changed

6 files changed

+27
-167
lines changed

app/pages/ProjectsPage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Metric = ({ label, value, className }: MetricProps) => (
2727
<div className="flex">
2828
<div className="text-display-lg mr-4">{value}</div>
2929
<div>
30-
<SparklineSVG className="stroke-current text-green-500 w-full" />
30+
<SparklineSVG className="stroke-green-500 w-full" />
3131
</div>
3232
</div>
3333
</div>

libs/ui/lib/breadcrumbs/Breadcrumbs.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const Breadcrumbs = ({ data }: BreadcrumbsProps) => (
1111
<ol className="text-xs font-mono uppercase mb-6">
1212
{data.map(({ href, label }) => (
1313
<li
14-
className="inline-block first-of-type:before:content-none
14+
className="inline-block before:first-of-type:content-none
1515
before:content-['/'] before:mx-2 before:text-gray-400"
1616
key={`${href}-${label}`}
1717
>

libs/ui/lib/radio/Radio.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const cardLabelStyles = `
4444
peer-disabled:hover:bg-gray-500
4545
4646
children:py-2 children:px-4 children:-mx-4 children:border-gray-400
47-
children:first:-mt-2 children:last:-mb-2
47+
first:children:-mt-2 last:children:-mb-2
4848
peer-checked:children:border-green-500
4949
cursor-pointer peer-disabled:cursor-default
5050
`

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@
108108
"postcss-nesting": "^8.0.1",
109109
"prettier": "2.4.0",
110110
"rollup": "^2.52.7",
111-
"tailwindcss": "^2.2.0",
112-
"tailwindcss-children": "^2.1.0",
111+
"tailwindcss": "^3.0.0-alpha.2",
113112
"ts-node": "^9.1.1",
114113
"tsconfig-paths-webpack-plugin": "^3.5.1",
115114
"typescript": "~4.4.2",

tailwind.config.js

+6-20
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@
33
/** @type {import('tailwindcss/lib/util/createPlugin').default} */
44
// @ts-ignore
55
const plugin = require('tailwindcss/plugin')
6-
const defaultConfig = require('tailwindcss/defaultConfig')
7-
8-
const childrenPlugin = require('tailwindcss-children')
96

107
/** @type {import('tailwindcss/tailwind-config').TailwindConfig} */
118
module.exports = {
12-
mode: 'jit',
13-
purge: ['./libs/ui/**/*.{ts,tsx,mdx}', './app/**/*.{ts,tsx}'],
14-
darkMode: false,
9+
content: ['./libs/ui/**/*.{ts,tsx,mdx}', './app/**/*.{ts,tsx}'],
1510
theme: {
1611
extend: {
1712
borderRadius: {
@@ -74,20 +69,11 @@ module.exports = {
7469
},
7570
},
7671
plugins: [
77-
// imitation of the twin.macro svg: variant. svg:text-green-500 puts green
78-
// on an SVG that's an immediate child of the element
79-
plugin(function ({ addVariant, e }) {
80-
addVariant('svg', ({ modifySelectors, separator }) => {
81-
modifySelectors(
82-
({ className }) => `.${e(`svg${separator}${className}`)} > svg`
83-
)
84-
})
72+
plugin(({ addVariant }) => {
73+
// imitation of the twin.macro svg: variant. svg:text-green-500 puts green
74+
// on an SVG that's an immediate child of the element
75+
addVariant('svg', '& > svg')
76+
addVariant('children', '& > *')
8577
}),
86-
childrenPlugin,
8778
],
88-
/**
89-
* TODO: This isn't respected, need an upstream fix.
90-
* @see https://github.com/tailwindlabs/tailwindcss/issues/3949
91-
*/
92-
variantOrder: ['children', ...defaultConfig.variantOrder, 'svg'],
9379
}

0 commit comments

Comments
 (0)