Skip to content

Commit

Permalink
TS ESM Tailwind config
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminleonard committed Dec 5, 2024
1 parent fd47bee commit c7e8e42
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@floating-ui/react": "^0.26.23",
"@headlessui/react": "^2.1.8",
"@oxide/design-system": "^1.7.2",
"@oxide/design-system": "^1.7.3--canary.ccb9825.0",
"@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-focus-guards": "1.0.1",
Expand Down
22 changes: 9 additions & 13 deletions tailwind.config.js → tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
* Copyright Oxide Computer Company
*/

// @ts-check
import { type Config } from 'tailwindcss'
import plugin from 'tailwindcss/plugin'

/** @type {import('tailwindcss/lib/util/createPlugin').default} */
// @ts-expect-error
const plugin = require('tailwindcss/plugin')
const {
textUtilities,
colorUtilities,
import {
borderRadiusTokens,
colorUtilities,
elevationUtilities,
} = require('@oxide/design-system/styles/dist/tailwind-tokens.js')
textUtilities,
} from '@oxide/design-system/styles/dist/tailwind-tokens.ts'

/** @type {import('tailwindcss/tailwind-config').TailwindConfig} */
module.exports = {
corePlugins: {
fontFamily: false,
Expand Down Expand Up @@ -57,7 +54,7 @@ module.exports = {
},
},
borderRadius: {
none: 0,
none: '0',
...borderRadiusTokens,
},
colors: {
Expand All @@ -66,7 +63,7 @@ module.exports = {
},
},
plugins: [
plugin(({ addVariant, addUtilities, variants }) => {
plugin(({ addVariant, addUtilities }) => {
addVariant('children', '& > *')
addVariant('selected', '.is-selected &')
addVariant('disabled', ['&.visually-disabled', '&:disabled'])
Expand All @@ -78,11 +75,10 @@ module.exports = {
},
}))
.reduce((p, c) => ({ ...p, ...c }), {}),
variants
)
addUtilities(textUtilities)

Check failure on line 79 in tailwind.config.ts

View workflow job for this annotation

GitHub Actions / ci

Argument of type 'Record<string, CSSProperties>' is not assignable to parameter of type 'CSSRuleObject | CSSRuleObject[]'.
addUtilities(colorUtilities)

Check failure on line 80 in tailwind.config.ts

View workflow job for this annotation

GitHub Actions / ci

Argument of type 'Record<string, CSSProperties>' is not assignable to parameter of type 'CSSRuleObject | CSSRuleObject[]'.
addUtilities(elevationUtilities)

Check failure on line 81 in tailwind.config.ts

View workflow job for this annotation

GitHub Actions / ci

Argument of type 'Record<string, CSSProperties>' is not assignable to parameter of type 'CSSRuleObject | CSSRuleObject[]'.
}),
],
}
} satisfies Config

0 comments on commit c7e8e42

Please sign in to comment.