-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Sync Tokens Studio config 🤖 (#112)
Changes done: - Figma only: Changed `font-family` and `font-weight` types to text and `font-weight` values to strings: Bold, Medium, Light, etc - Figma only: Changed `line-height` type to number and value to px - Fix value for `static.orange.default` color [category:Infrastructure] Release Note: Incorrect value of `sys.color.static.orange.default` token has been changed to the correct `cantaloupe.400`. Token Studio structure has been updated for Figma only (types and `font-weight`, `line-height` values changes). Co-authored-by: @RayRedGoose <[email protected]>
- Loading branch information
1 parent
12c501d
commit 21f5e57
Showing
5 changed files
with
90 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/canvas-tokens/utils/transformers/mapFontWeight.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {DesignToken} from 'style-dictionary'; | ||
|
||
type Transformer = (token: DesignToken) => string; | ||
|
||
const mappedFontWeight = { | ||
Light: '300', | ||
Regular: '400', | ||
Medium: '500', | ||
Bold: '700', | ||
}; | ||
|
||
/** | ||
* [Style Dictionary custom transform function](https://amzn.github.io/style-dictionary/#/transforms?id=defining-custom-transforms) that | ||
* transforms the string values to number | ||
* @param {*} Token - style dictionary token object. | ||
* @returns updated token value | ||
*/ | ||
export const mapFontWeight: Transformer = ({value}) => { | ||
if (value in mappedFontWeight) { | ||
return mappedFontWeight[value as keyof typeof mappedFontWeight]; | ||
} | ||
|
||
return value; | ||
}; |