-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: develop
Are you sure you want to change the base?
feat: Introduce and use brand and common typography tokens #1760
Conversation
73a0f78
to
855d488
Compare
There was a problem hiding this comment.
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.
"brand": { | ||
"typography": { | ||
"font-family": { | ||
"body-text": { "value": "'Amsterdam Sans', Arial, sans-serif" }, |
There was a problem hiding this comment.
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
"typography": { | ||
"font-family": { | ||
"body-text": { "value": "'Amsterdam Sans', Arial, sans-serif" }, | ||
"headings": { "value": "'Amsterdam Sans', Arial, sans-serif" }, |
There was a problem hiding this comment.
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.
"font-family": { | ||
"body-text": { "value": "'Amsterdam Sans', Arial, sans-serif" }, | ||
"headings": { "value": "'Amsterdam Sans', Arial, sans-serif" }, | ||
"monospace": { "value": "monospace" } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
"bold": { "value": 700 }, | ||
"x-bold": { "value": 800 } | ||
}, | ||
"line-height": { |
There was a problem hiding this comment.
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.
"font-size": { "value": "{ams.brand.typography.font-size.lg}" }, | ||
"line-height": { "value": "{ams.brand.typography.line-height.2xl}" } | ||
}, | ||
"xl": { |
There was a problem hiding this comment.
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.
"typography": { | ||
"body-text": { | ||
"font-family": { "value": "{ams.brand.typography.font-family.body-text}" }, | ||
"font-size": { "value": "{ams.brand.typography.font-size.md}" }, |
There was a problem hiding this comment.
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.bold}" } | ||
}, | ||
"headings": { | ||
"font-family": { "value": "{ams.brand.typography.font-family.headings}" }, |
There was a problem hiding this comment.
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.
"line-height": { "value": "{ams.brand.typography.line-height.md}" } | ||
} | ||
}, | ||
"bold": { |
There was a problem hiding this comment.
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.
@@ -0,0 +1,17 @@ | |||
{ | |||
"ams": { |
There was a problem hiding this comment.
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.
"font-family": { | ||
"body-text": { "value": "'Amsterdam Sans', Arial, sans-serif" }, | ||
"headings": { "value": "'Amsterdam Sans', Arial, sans-serif" }, | ||
"monospace": { "value": "monospace" } |
There was a problem hiding this comment.
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.
"brand": { | ||
"typography": { | ||
"font-size": { | ||
"sm": { "value": "clamp(0.8889rem, calc(0.9141rem + -0.0253vw), 0.9091rem)" }, |
There was a problem hiding this comment.
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.
"light": { "value": 300 }, | ||
"normal": { "value": 400 }, | ||
"bold": { "value": 700 }, | ||
"x-bold": { "value": 800 } |
There was a problem hiding this comment.
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.
"common": { | ||
"typography": { | ||
"body-text": { | ||
"font-family": { "value": "{ams.brand.typography.font-family.body-text}" }, |
There was a problem hiding this comment.
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?
@@ -40,7 +40,7 @@ | |||
.sbdocs-content.sbdocs-content > .ams-storybook-status-badge > span:nth-child(2) { | |||
color: #000; | |||
font-family: "Amsterdam Sans", "Arial", sans-serif; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the custom property?
@@ -0,0 +1,61 @@ | |||
{ | |||
"ams": { | |||
"common": { |
There was a problem hiding this comment.
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-
?
Describe the pull request
Thank you for contributing to the project!
Please use this template to help us handle your PR smoothly.
What
ams.brand
andams.common
text
totypography
ams.text
tokensWhy
<Heading level={4}>
needs a small line height, while<Paragraph size="large">
needs a large one. Rather than only splitting some levels into two (e.g.text-level-4-(heading|body-text)-line-height
), we’ve separated the two concepts entirely.How
font-size
,line-height
,font-family
andfont-weight
Checklist
Before submitting your pull request, please ensure you have done the following. Check each checkmark if you have done so or if it wasn't necessary: