diff --git a/.changeset/modern-lizards-play.md b/.changeset/modern-lizards-play.md new file mode 100644 index 00000000000..fd865cd0210 --- /dev/null +++ b/.changeset/modern-lizards-play.md @@ -0,0 +1,5 @@ +--- +"@primer/components": patch +--- + +Migrate theme to TypeScript diff --git a/src/__tests__/themeGet.js b/src/__tests__/themeGet.ts similarity index 100% rename from src/__tests__/themeGet.js rename to src/__tests__/themeGet.ts diff --git a/src/theme-preval.js b/src/theme-preval.ts similarity index 97% rename from src/theme-preval.js rename to src/theme-preval.ts index 9845f5b76bf..654e2057c4e 100644 --- a/src/theme-preval.js +++ b/src/theme-preval.ts @@ -1,12 +1,10 @@ -// @preval - -const {colors: colorPrimitives, typography} = require('@primer/primitives') -const {lighten, rgba, desaturate} = require('polished') +import {colors as colorPrimitives, typography} from '@primer/primitives' +import {lighten, rgba, desaturate} from 'polished' const {lineHeights} = typography const {black, white, pink, gray, blue, green, orange, purple, red, yellow} = colorPrimitives // General -const colors = { +export const colors = { bodytext: gray[9], black, white, @@ -350,7 +348,7 @@ const stateLabels = { } } -const theme = { +export const theme = { // General borderWidths, breakpoints, @@ -373,11 +371,6 @@ const theme = { stateLabels } -module.exports = { - theme, - colors -} - -function fontStack(fonts) { +function fontStack(fonts: string[]) { return fonts.map(font => (font.includes(' ') ? `"${font}"` : font)).join(', ') } diff --git a/src/theme.js b/src/theme.js deleted file mode 100644 index 3a0afbdd1af..00000000000 --- a/src/theme.js +++ /dev/null @@ -1,5 +0,0 @@ -const themeExport = require('./theme-preval') -const {theme, colors} = themeExport - -export default theme -export {colors} diff --git a/src/theme.ts b/src/theme.ts new file mode 100644 index 00000000000..494c8060eb4 --- /dev/null +++ b/src/theme.ts @@ -0,0 +1,4 @@ +import {theme, colors} from /* preval */ './theme-preval' + +export default theme +export {colors}