-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: incorporate chakra type generation in the workflow #1207
Conversation
8cf3f22
to
d2b9dd5
Compare
@@ -11,7 +11,7 @@ const meta: Meta<typeof VehicleReference> = { | |||
component: VehicleReference, | |||
decorators: [ | |||
(Story) => ( | |||
<Box maxW={{ '2xs': '100%', md: '600px' }}> | |||
<Box maxW={{ '2xs': 'full', md: '7xl' }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strict tokens mean we need to use design tokens here
@@ -43,8 +43,11 @@ | |||
"format:i18n": "npx sort-phraseapp-locales src/locales/de/dict.json src/locales/en/dict.json src/locales/fr/dict.json src/locales/it/dict.json --fix", | |||
"format": "npm run format:i18n && npm run lint -- --fix", | |||
"typecheck": "tsc --noEmit", | |||
"typegen": "npx chakra typegen src/themes/autoScout24.ts --clean", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to pass a single system; both shapes are the same.
src/components/icons/HeartIcon.tsx
Outdated
fill?: 'none'; | ||
stroke?: 'currentColor'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extending props as these values are not supported and we need them for animations in listings
src/components/icons/CompareIcon.tsx
Outdated
@@ -15,7 +15,7 @@ export const CompareIcon = createIcon({ | |||
), | |||
defaultProps: { | |||
boxSize: 'sm', | |||
fill: 'currentColor', | |||
fill: 'currentBg', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentColor
is not supported, currentBg
makes sense for fill
src/components/icons/RocketIcon.tsx
Outdated
fill: 'none', | ||
stroke: 'currentColor', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't seem to pass these as props, moving them to the path definition
@@ -51,19 +51,19 @@ const meta: Meta<typeof ThemeProvider> = { | |||
box: ( | |||
<Box | |||
display="flex" | |||
direction="row" | |||
flexDirection="row" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
direction
works on Stack
, but css
direction attribute has nothing with flex directions.
@@ -1,6 +1,7 @@ | |||
import { defineTokens } from '@chakra-ui/react'; | |||
|
|||
export const sizes = defineTokens.sizes({ | |||
auto: { value: 'auto' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this as a utility
@@ -1,6 +1,7 @@ | |||
import { defineTokens } from '@chakra-ui/react'; | |||
|
|||
export const spacing = defineTokens.spacing({ | |||
'0': { value: '0' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this as a utility
tokenPath: string; | ||
renderValue?: boolean; | ||
renderDemo?: (tokenValue: string) => React.ReactNode; | ||
renderDemo?: (tokenName: Tokens[Token]) => React.ReactNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we pass string
and want to use it as a token value, strict tokens would yell at us.
This is why we add type parameters so we can properly cast a token name to an expected token.
@@ -22,7 +22,7 @@ const conversionToPixels = { | |||
|
|||
export const BorderRadius: StoryType = { | |||
render: () => ( | |||
<TokenShowcase | |||
<TokenShowcase<'radii'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing token type
none: { value: 'none' }, | ||
currentColor: { value: 'currentColor' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this two utilities to streamline svg icons
🎉 This PR is included in version 23.12.0-chakra-v3-2b01e1695f18cd9d9904654a954403715816f889.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 23.12.0-chakra-v3-48faf66f285855f83fe067b3e1023b7d201e3356.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 23.12.0-chakra-v3-cd3fc71866ab1effc5e6b22bb42a02eb8dd830bd.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 23.12.0-chakra-v3-b007baa34b3042d13cb9ebf96bd863b4c5b0e151.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 23.15.0-chakra-v3-f0a29c4689b248124d11f182c1701bad4af03971.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 23.16.0-chakra-v3-1179149485ac09b9c262ae8648e855b1ce506b02.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 23.16.0-chakra-v3-7a58fab7dfb141d07161cc692ea467088dbf00b4.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 23.17.0-chakra-v3-ed38805868813712826f68f9fd6cbcde5f1c3db6.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 23.17.0-chakra-v3-a3e5a49230070338bd79966543c4f14023c39dab.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
References: https://smg-au.atlassian.net/browse/FED-421
Chakra-ui provides type generation based on the tokens defined in the theme.
This PR integrates the typegen in our workflow and ensures that we have proper type definitions in our component library