Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce and use brand and common typography tokens #1760

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
3 changes: 0 additions & 3 deletions proprietary/tokens/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ defaultMode.buildAllPlatforms()

modes.map((mode) => {
const styleDictionary = new StyleDictionary({
log: {
verbosity: 'verbose',
},
source: [`./src/**/*.${mode}.tokens.json`],
platforms: generateSharedConfig(mode),
})
Expand Down
29 changes: 0 additions & 29 deletions proprietary/tokens/src/brand/ams/text.compact.tokens.json

This file was deleted.

41 changes: 0 additions & 41 deletions proprietary/tokens/src/brand/ams/text.tokens.json

This file was deleted.

17 changes: 17 additions & 0 deletions proprietary/tokens/src/brand/ams/typography.compact.tokens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"ams": {
Copy link
Contributor

@dlnr dlnr Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To maintain the history of the file you can use git mv, just renaming it deletes it and adds a new file.

"brand": {
"typography": {
"font-size": {
"sm": { "value": "clamp(0.8889rem, calc(0.9141rem + -0.0253vw), 0.9091rem)" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This grows smaller on desktop.

"md": { "value": "1rem" },
"lg": { "value": "clamp(1.1rem, calc(1.0938rem + 0.0313vw), 1.125rem)" },
"xl": { "value": "clamp(1.21rem, calc(1.1961rem + 0.0695vw), 1.2656rem)" },
"2xl": { "value": "clamp(1.331rem, calc(1.3078rem + 0.116vw), 1.4238rem)" },
"3xl": { "value": "clamp(1.4641rem, calc(1.4297rem + 0.1721vw), 1.6018rem)" },
"4xl": { "value": "clamp(1.6105rem, calc(1.5626rem + 0.2394vw), 1.802rem)" }
}
}
}
}
}
39 changes: 39 additions & 0 deletions proprietary/tokens/src/brand/ams/typography.tokens.json
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much more focused now: just our selection of font families, sizes and weights, and line heights, with proper names for their options.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"ams": {
"brand": {
"typography": {
"font-family": {
"body-text": { "value": "'Amsterdam Sans', Arial, sans-serif" },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including -text is clearer than just body. I dismissed body-copy for not being very common. Utrecht uses ‘document’, but headings are also in the document.

A typesetter […] sees 'body text' as being those sections of the main text that are flowed into columns or justified as paragraphs, as distinct from the headings and any pictures that are floated out of the main body.
Wikipedia

"headings": { "value": "'Amsterdam Sans', Arial, sans-serif" },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Headings include labels and fieldset legends as well. And accordion buttons use these tokens.

"monospace": { "value": "monospace" }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be too soon to add this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add a <code> component it might come in handy.

},
"font-size": {
"sm": { "value": "clamp(0.9643rem, calc(0.9054rem + 0.2946vw), 1.2rem)" },
"md": { "value": "clamp(1.125rem, calc(1.0313rem + 0.4688vw), 1.5rem)" },
"lg": { "value": "clamp(1.3125rem, calc(1.1719rem + 0.7031vw), 1.875rem)" },
"xl": { "value": "clamp(1.5313rem, calc(1.3281rem + 1.0156vw), 2.3438rem)" },
"2xl": { "value": "clamp(1.7865rem, calc(1.5007rem + 1.429vw), 2.9297rem)" },
"3xl": { "value": "clamp(2.0842rem, calc(1.6897rem + 1.9724vw), 3.6621rem)" },
"4xl": { "value": "clamp(2.4316rem, calc(1.8951rem + 2.6826vw), 4.5776rem)" }
},
"font-weight": {
"light": { "value": 300 },
"normal": { "value": 400 },
"bold": { "value": 700 },
"x-bold": { "value": 800 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"bolder" might be more common.

},
"line-height": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve calculated this scale precisely like we did for font sizes. I started with 1.66667 for paragraphs and found a factor of 31/32 to generated line heights very close to what we aimed for.

The 7 smallest are all used for consecutive heading levels. The 4 largest, creating 1 overlapping, for body text levels. Not all options (e.g. 4xl) have been made available.

"5xs": { "value": "113.86%" },
"4xs": { "value": "117.54%" },
"3xs": { "value": "121.33%" },
"2xs": { "value": "125.24%" },
"xs": { "value": "129.28%" },
"sm": { "value": "133.45%" },
"md": { "value": "137.76%" },
"2xl": { "value": "151.52%" },
"5xl": { "value": "166.67%" }
}
}
}
}
}
61 changes: 61 additions & 0 deletions proprietary/tokens/src/common/ams/typography.tokens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"ams": {
"common": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this prefix? We don't previx component properties ams-components-?

"typography": {
"body-text": {
"font-family": { "value": "{ams.brand.typography.font-family.body-text}" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to look at the bundler for the tokens here, because everything is bundled. So you're creating:

--ams-brand-typography-font-family and --ams-common-typography-body-text-font-family

Do we need both and how is it more semantic?

"font-size": { "value": "{ams.brand.typography.font-size.md}" },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and line height apply to md – I chose not to make that level explicit, but to make these values the baseline, overridden by the variants, just like we do in CSS.

"font-weight": { "value": "{ams.brand.typography.font-weight.normal}" },
"line-height": { "value": "{ams.brand.typography.line-height.5xl}" },
"sm": {
"font-size": { "value": "{ams.brand.typography.font-size.sm}" },
"line-height": { "value": "{ams.brand.typography.line-height.2xl}" }
},
"lg": {
"font-size": { "value": "{ams.brand.typography.font-size.lg}" },
"line-height": { "value": "{ams.brand.typography.line-height.2xl}" }
},
"xl": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new level for blockquotes because they are not headings.

"font-size": { "value": "{ams.brand.typography.font-size.xl}" },
"line-height": { "value": "{ams.brand.typography.line-height.md}" }
}
},
"bold": {
Copy link
Contributor Author

@VincentSmedinga VincentSmedinga Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure about this one. Is a phrase or paragraph of bold text a variation? Badge uses it, for example. And blockquote. Does it make sense to let our future .ams-strong use this token?

We could also name it ‘emphasis’ and combine it with italics – normal and strong emphasis.

"font-weight": { "value": "{ams.brand.typography.font-weight.bold}" }
},
"headings": {
"font-family": { "value": "{ams.brand.typography.font-family.headings}" },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having two separate tokens for the font-family of headings and body text, while we use the same font for both, allows the community to use two different typefaces.

"font-weight": { "value": "{ams.brand.typography.font-weight.x-bold}" },
"level-0": {
"font-size": { "value": "{ams.brand.typography.font-size.4xl}" },
"line-height": { "value": "{ams.brand.typography.line-height.5xs}" }
},
"level-1": {
"font-size": { "value": "{ams.brand.typography.font-size.3xl}" },
"line-height": { "value": "{ams.brand.typography.line-height.4xs}" }
},
"level-2": {
"font-size": { "value": "{ams.brand.typography.font-size.2xl}" },
"line-height": { "value": "{ams.brand.typography.line-height.3xs}" }
},
"level-3": {
"font-size": { "value": "{ams.brand.typography.font-size.xl}" },
"line-height": { "value": "{ams.brand.typography.line-height.2xs}" }
},
"level-4": {
"font-size": { "value": "{ams.brand.typography.font-size.lg}" },
"line-height": { "value": "{ams.brand.typography.line-height.xs}" }
},
"level-5": {
"font-size": { "value": "{ams.brand.typography.font-size.md}" },
"line-height": { "value": "{ams.brand.typography.line-height.sm}" }
},
"level-6": {
"font-size": { "value": "{ams.brand.typography.font-size.sm}" },
"line-height": { "value": "{ams.brand.typography.line-height.md}" }
}
}
}
}
}
}
8 changes: 4 additions & 4 deletions proprietary/tokens/src/components/ams/accordion.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"gap": { "value": "{ams.space.md}" },
"button": {
"color": { "value": "{ams.brand.color.blue.60}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.5.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.bold}" },
"font-family": { "value": "{ams.common.typography.headings.font-family}" },
"font-size": { "value": "{ams.common.typography.headings.level-5.font-size}" },
"font-weight": { "value": "{ams.common.typography.headings.font-weight}" },
"gap": { "value": "{ams.space.sm}" },
"line-height": { "value": "{ams.text.level.5.line-height}" },
"line-height": { "value": "{ams.common.typography.headings.level-5.line-height}" },
"padding-block": { "value": "{ams.space.sm}" },
"padding-inline": { "value": "0" },
"focus": {
Expand Down
8 changes: 4 additions & 4 deletions proprietary/tokens/src/components/ams/avatar.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"ams": {
"avatar": {
"aspect-ratio": { "value": "{ams.aspect-ratio.square}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.6.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.normal}" },
"line-height": { "value": "{ams.text.level.6.line-height}" },
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.sm.font-size}" },
"font-weight": { "value": "{ams.common.typography.body-text.font-weight}" },
"line-height": { "value": "{ams.common.typography.body-text.sm.line-height}" },
"padding-block": { "value": "{ams.space.xs}" },
"padding-inline": { "value": "{ams.space.xs}" },
"azure": {
Expand Down
8 changes: 4 additions & 4 deletions proprietary/tokens/src/components/ams/badge.tokens.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"ams": {
"badge": {
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.5.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.bold}" },
"line-height": { "value": "{ams.text.level.5.line-height}" },
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.font-size}" },
"font-weight": { "value": "{ams.common.typography.bold.font-weight}" },
"line-height": { "value": "{ams.common.typography.body-text.line-height}" },
"padding-inline": { "value": "{ams.space.xs}" },
"azure": {
"background-color": { "value": "{ams.brand.color.azure.60}" },
Expand Down
10 changes: 5 additions & 5 deletions proprietary/tokens/src/components/ams/blockquote.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"ams": {
"blockquote": {
"color": { "value": "{ams.brand.color.neutral.100}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.3.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.bold}" },
"line-height": { "value": "{ams.text.level.3.line-height}" },
"inverse-color": { "value": "{ams.brand.color.neutral.0}" }
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.xl.font-size}" },
"font-weight": { "value": "{ams.common.typography.bold.font-weight}" },
"inverse-color": { "value": "{ams.brand.color.neutral.0}" },
"line-height": { "value": "{ams.common.typography.body-text.xl.line-height}" }
}
}
}
8 changes: 4 additions & 4 deletions proprietary/tokens/src/components/ams/breadcrumb.tokens.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"ams": {
"breadcrumb": {
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.6.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.normal}" },
"line-height": { "value": "{ams.text.level.6.line-height}" },
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.sm.font-size}" },
"font-weight": { "value": "{ams.common.typography.body-text.font-weight}" },
"line-height": { "value": "{ams.common.typography.body-text.sm.line-height}" },
"separator": {
"background-image": {
"value": "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path fill='%23000000' fill-rule='evenodd' d='m9.757 32-2.9-2.91L19.937 16 6.857 2.91 9.757 0l16 16z'/></svg>\")"
Expand Down
6 changes: 3 additions & 3 deletions proprietary/tokens/src/components/ams/button.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"ams": {
"button": {
"cursor": { "value": "{ams.action.activate.cursor}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.5.font-size}" },
"line-height": { "value": "{ams.text.level.5.line-height}" },
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.font-size}" },
"line-height": { "value": "{ams.common.typography.body-text.line-height}" },
"gap": { "value": "{ams.space.sm}" },
"outline-offset": { "value": "{ams.focus.outline-offset}" },
"padding-block": { "value": "{ams.space.sm}" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"ams": {
"character-count": {
"color": { "value": "{ams.brand.color.neutral.100}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.6.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.normal}" },
"line-height": { "value": "{ams.text.level.6.line-height}" },
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.sm.font-size}" },
"font-weight": { "value": "{ams.common.typography.body-text.font-weight}" },
"line-height": { "value": "{ams.common.typography.body-text.sm.line-height}" },
"error": {
"color": { "value": "{ams.brand.color.red.60}" }
}
Expand Down
8 changes: 4 additions & 4 deletions proprietary/tokens/src/components/ams/checkbox.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"ams": {
"checkbox": {
"color": { "value": "{ams.brand.color.neutral.100}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.5.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.normal}" },
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.font-size}" },
"font-weight": { "value": "{ams.common.typography.body-text.font-weight}" },
"gap": { "value": "{ams.space.sm}" },
"line-height": { "value": "{ams.text.level.5.line-height}" },
"line-height": { "value": "{ams.common.typography.body-text.line-height}" },
"outline-offset": { "value": "{ams.focus.outline-offset}" },
"checkmark": {
"border-color": { "value": "{ams.brand.color.blue.60}" },
Expand Down
8 changes: 4 additions & 4 deletions proprietary/tokens/src/components/ams/date-input.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"background-color": { "value": "{ams.brand.color.neutral.0}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border.width.sm} {ams.brand.color.neutral.100}" },
"color": { "value": "{ams.brand.color.neutral.100}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.5.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.normal}" },
"line-height": { "value": "{ams.text.level.5.line-height}" },
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.font-size}" },
"font-weight": { "value": "{ams.common.typography.body-text.font-weight}" },
"line-height": { "value": "{ams.common.typography.body-text.line-height}" },
"outline-offset": { "value": "{ams.focus.outline-offset}" },
"padding-block": { "value": "{ams.space.sm}" },
"padding-inline": { "value": "{ams.space.md}" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"description-list": {
"color": { "value": "{ams.brand.color.neutral.100}" },
"column-gap": { "value": "{ams.space.lg}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.5.font-size}" },
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.font-size}" },
"inverse-color": { "value": "{ams.brand.color.neutral.0}" },
"line-height": { "value": "{ams.text.level.5.line-height}" },
"line-height": { "value": "{ams.common.typography.body-text.line-height}" },
"row-gap": { "value": "{ams.space.sm}" },
"term": {
"font-weight": { "value": "{ams.text.font-weight.bold}" }
"font-weight": { "value": "{ams.common.typography.bold.font-weight}" }
},
"description": {
"font-weight": { "value": "{ams.text.font-weight.normal}" },
"font-weight": { "value": "{ams.common.typography.body-text.font-weight}" },
"padding-inline-start": { "value": "{ams.space.lg}" }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"ams": {
"error-message": {
"color": { "value": "{ams.brand.color.red.60}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.6.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.normal}" },
"font-family": { "value": "{ams.common.typography.body-text.font-family}" },
"font-size": { "value": "{ams.common.typography.body-text.sm.font-size}" },
"font-weight": { "value": "{ams.common.typography.body-text.font-weight}" },
"gap": { "value": "{ams.space.xs}" },
"line-height": { "value": "{ams.text.level.6.line-height}" }
"line-height": { "value": "{ams.common.typography.body-text.sm.line-height}" }
}
}
}
8 changes: 4 additions & 4 deletions proprietary/tokens/src/components/ams/field-set.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
},
"legend": {
"color": { "value": "{ams.brand.color.neutral.100}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.4.font-size}" },
"font-weight": { "value": "{ams.text.font-weight.bold}" },
"line-height": { "value": "{ams.text.level.4.line-height}" },
"font-family": { "value": "{ams.common.typography.headings.font-family}" },
"font-size": { "value": "{ams.common.typography.headings.level-4.font-size}" },
"font-weight": { "value": "{ams.common.typography.headings.font-weight}" },
"line-height": { "value": "{ams.common.typography.headings.level-4.line-height}" },
"margin-block-end": { "value": "{ams.space.md}" }
}
}
Expand Down
Loading