Skip to content

Commit

Permalink
Update getFontWeight.ts
Browse files Browse the repository at this point in the history
Rename "weightMapping" to "weights" to be more uniform with the base.
  • Loading branch information
JeroenRoodIHS authored Feb 27, 2024
1 parent 40bbd24 commit 9c62bfe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/text/getFontWeight.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const getFontWeight = (fontWeight: string) => {
const inputFontWeight = fontWeight.toLowerCase();

const weightMapping = {
const weights = {
100 : ["thin", "hairline", "100"],
200 : ["extra-light", "extraLight", "ultra-light", "ultraLight", "200"],
300 : ["light", "300"],
Expand All @@ -13,5 +13,5 @@ export const getFontWeight = (fontWeight: string) => {
900 : ["black", "heavy", "900"],
950 : ["extra-black", "ultra-black", "extraBlack", "ultraBlack", "950"]
}
return Object.keys(weightMapping).find(weight => weightMapping[weight].includes(inputFontWeight)) || 400;
return Object.keys(weights).find(weight => weights[weight].includes(inputFontWeight)) || 400;
};

0 comments on commit 9c62bfe

Please sign in to comment.