Skip to content

Commit 4e0de8a

Browse files
committed
Support single typo issue
1 parent fb0c97f commit 4e0de8a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/utils/__tests__/text-style-to-typography.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ describe('textStyleToTypography', () => {
2727
['Thin', 100],
2828
['Extra Light', 200],
2929
['Light', 300],
30+
['4', 400],
31+
['4 Normal', 400],
3032
['Regular', 400],
3133
['normal', 400],
3234
['Medium', 500],

src/utils/text-style-to-typography.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,12 @@ function getFontWeight(weight: string): number {
4242
}
4343

4444
const weightNumber = Number.parseInt(weight, 10)
45+
if (
46+
Number.isInteger(weightNumber) &&
47+
weightNumber >= 1 &&
48+
weightNumber <= 9
49+
) {
50+
return weightNumber * 100
51+
}
4552
return Number.isNaN(weightNumber) ? 400 : weightNumber
4653
}

0 commit comments

Comments
 (0)