Skip to content

Commit

Permalink
Fix types for expanded (typography) tokens (#1423)
Browse files Browse the repository at this point in the history
Fixes #1417

The ideal fix IMO would be to make all typography types singular. That
is a more elaborate (and breaking) change though. So I thought this
could already be a quick fix so it's at least consistent :)

Co-authored-by: Jan Six <six.jan@gmail.com>
  • Loading branch information
thomasmattheussen and six7 authored Nov 12, 2022
1 parent b587c09 commit b0e4e69
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/app/components/ExportProvider/SingleFileExport.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ describe('SingleFileExport', () => {
headline: {
fontFamily: {
value: 'Inter',
type: 'fontFamily',
type: 'fontFamilies',
},
fontWeight: {
value: 'Bold',
type: 'fontWeight',
type: 'fontWeights',
},
},
alias: {
Expand Down
12 changes: 12 additions & 0 deletions src/utils/convertToDefaultProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ export function convertToDefaultProperty(property: string): string {
case Properties.borderWidthBottom:
type = Properties.borderWidth;
break;
case 'fontFamily':
type = Properties.fontFamilies;
break;
case 'fontSize':
type = Properties.fontSizes;
break;
case 'fontWeight':
type = Properties.fontWeights;
break;
case 'lineHeights':
type = Properties.lineHeights;
break;
default:
type = property;
break;
Expand Down
18 changes: 9 additions & 9 deletions src/utils/formatTokens.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,43 +116,43 @@ describe('formatTokens', () => {
h1: {
fontFamily: {
value: 'Inter',
type: 'fontFamily',
type: 'fontFamilies',
},
fontWeight: {
value: 'Bold',
type: 'fontWeight',
type: 'fontWeights',
},
fontSize: {
value: 36,
type: 'fontSize',
type: 'fontSizes',
},
},
h2: {
fontFamily: {
value: 'Inter',
type: 'fontFamily',
type: 'fontFamilies',
},
fontWeight: {
value: 'Regular',
type: 'fontWeight',
type: 'fontWeights',
},
fontSize: {
value: 24,
type: 'fontSize',
type: 'fontSizes',
},
},
alias: {
fontFamily: {
value: 'Inter',
type: 'fontFamily',
type: 'fontFamilies',
},
fontWeight: {
value: 'Bold',
type: 'fontWeight',
type: 'fontWeights',
},
fontSize: {
value: 36,
type: 'fontSize',
type: 'fontSizes',
},
},
non_resolved: {
Expand Down
6 changes: 3 additions & 3 deletions token-transformer/output/composition.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
"header": {
"fontFamily": {
"value": "Roboto",
"type": "fontFamily"
"type": "fontFamilies"
},
"fontSize": {
"value": 96,
"type": "fontSize"
"type": "fontSizes"
},
"fontWeight": {
"value": "Bold",
"type": "fontWeight"
"type": "fontWeights"
}
},
"body": {
Expand Down

0 comments on commit b0e4e69

Please sign in to comment.