Skip to content

Commit

Permalink
refactor: destructuring name token
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Feb 23, 2023
1 parent 0d83cb0 commit fa0910a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tokens/css-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* Implements bg-variant mixin from bootstrap. Creates utility classes for background colors based on theme color.
*/
function bgVariant(token) {
const { attributes: { type, item }, actions } = token;
const { attributes: { type, item }, name, actions } = token;
const parent = `.bg-${type}${item === 'base' ? '' : `-${item}`}`;
return `${parent} {
background-color: ${`var(--${token.name})`} !important;
background-color: ${`var(--${name})`} !important;
}
a${parent}:hover,
Expand All @@ -22,10 +22,10 @@ button${parent}:focus {
* Implements text-emphasis-variant mixin from bootstrap. Creates utility classes for text colors based on theme color.
*/
function textEmphasisVariant(token) {
const { attributes: { type, item }, actions } = token;
const { attributes: { type, item }, name, actions } = token;
const parent = `.text-${type}${item === 'base' ? '' : `-${item}`}`;
return `${parent} {
color: ${`var(--${token.name})`} !important;
color: ${`var(--${name})`} !important;
}
a${parent}:hover,
Expand All @@ -40,10 +40,10 @@ a${parent}:focus {
* Creates utility class for border color.
*/
function borderColor(token) {
const { attributes: { type, item } } = token;
const { attributes: { type, item }, name } = token;
const className = `.border-${type}${item === 'base' ? '' : `-${item}`}`;
return `${className} {
border-color: ${`var(--${token.name})`} !important;
border-color: ${`var(--${name})`} !important;
}
`;
Expand Down

0 comments on commit fa0910a

Please sign in to comment.