You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's an annoying user experience where I have to provide the entire set of font related CSS properties (set of font-family, font-size, font-weight) to different components on the page. A better approach would have been if we can import the design system from the CSS/SCSS files sitting in our project.
Derive design tokens from CSS/SCSS files
Detect basic tokens
Suppose the pages/index.tsx imports a SCSS file like import "./index.scss";. All the CSS variables in :root as shown below will be processed as either color and dimension etc.
Typography tokens - A mixin that contains only typography related CSS properties.
Layout tokens - A mixin that contains flex related CSS properties.
Spacing tokens - A mixin that contains padding/margin related CSS properties.
A CSS/SCSS file can import other CSS file. We need to collect all the token from these files. Ignore node_modules unless included specifically in the atriConfig.
Tokens first styles panel
Currently the styles panel allows user to assign CSS values manually. The styles panel need to be re-designed in such a way that the most accessible values are tokens. For example, the Typography section should have a dropdown on top that allows user to select from one of the Special composite tokens for Typography. Rest of the options can be hidden in more.
For CSS properties that take color as value should get color tokens in dropdown when the user clicks on the color input box. Similarly, for any CSS properties that size (px, em, rem) as value should get all space tokens.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
It's an annoying user experience where I have to provide the entire set of font related CSS properties (set of
font-family
,font-size
,font-weight
) to different components on the page. A better approach would have been if we can import the design system from the CSS/SCSS files sitting in our project.Derive design tokens from CSS/SCSS files
Detect basic tokens
Suppose the
pages/index.tsx
imports a SCSS file likeimport "./index.scss";
. All the CSS variables in:root
as shown below will be processed as eithercolor
anddimension
etc.Detect composite tokens
Extract all mixins for composite tokens.
Detect font-import
import ("https://fonts.google.com....");
Detect url
Special composite tokens
Typography tokens - A mixin that contains only typography related CSS properties.
Layout tokens - A mixin that contains flex related CSS properties.
Spacing tokens - A mixin that contains padding/margin related CSS properties.
Walk the CSS dependency tree
A CSS/SCSS file can import other CSS file. We need to collect all the token from these files. Ignore
node_modules
unless included specifically in theatriConfig
.Tokens first styles panel
Currently the styles panel allows user to assign CSS values manually. The styles panel need to be re-designed in such a way that the most accessible values are tokens. For example, the Typography section should have a dropdown on top that allows user to select from one of the Special composite tokens for Typography. Rest of the options can be hidden in
more
.For CSS properties that take color as value should get color tokens in dropdown when the user clicks on the color input box. Similarly, for any CSS properties that size (px, em, rem) as value should get all space tokens.
Beta Was this translation helpful? Give feedback.
All reactions