Skip to content

Commit

Permalink
chore: Convert tailwind config to typescript file (#2599)
Browse files Browse the repository at this point in the history
* convert tailwind config to typescript file

* try design-system canary that fixes everything

* upgrade to non-canary design-system, fix import
  • Loading branch information
david-crespo authored Dec 5, 2024
1 parent fd47bee commit 081599c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 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",
"@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-focus-guards": "1.0.1",
Expand Down
33 changes: 10 additions & 23 deletions tailwind.config.js → tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@
* 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 = {
export default {
corePlugins: {
fontFamily: false,
fontSize: false,
Expand Down Expand Up @@ -57,7 +54,7 @@ module.exports = {
},
},
borderRadius: {
none: 0,
none: '0',
...borderRadiusTokens,
},
colors: {
Expand All @@ -66,23 +63,13 @@ module.exports = {
},
},
plugins: [
plugin(({ addVariant, addUtilities, variants }) => {
plugin(({ addVariant, addUtilities }) => {
addVariant('children', '& > *')
addVariant('selected', '.is-selected &')
addVariant('disabled', ['&.visually-disabled', '&:disabled'])
addUtilities(
Array.from({ length: 12 }, (_, i) => i)
.map((i) => ({
[`.grid-col-${i}`]: {
'grid-column': `${i}`,
},
}))
.reduce((p, c) => ({ ...p, ...c }), {}),
variants
)
addUtilities(textUtilities)
addUtilities(colorUtilities)
addUtilities(elevationUtilities)
}),
],
}
} satisfies Config

0 comments on commit 081599c

Please sign in to comment.