-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(styles): add support for IBM Plex from the @ibm/plex
package
#10205
feat(styles): add support for IBM Plex from the @ibm/plex
package
#10205
Conversation
@ibm/plex
package
FYI @vpicone |
…bon into feat/add-support-for-fonts
✔️ Deploy Preview for carbon-react-next ready! 🔨 Explore the source changes: ea40851 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/61aa48a12b52a30007337816 😎 Browse the preview: https://deploy-preview-10205--carbon-react-next.netlify.app |
✔️ Deploy Preview for carbon-components-react ready! 🔨 Explore the source changes: ea40851 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/61aa48a111d27e00070bda13 😎 Browse the preview: https://deploy-preview-10205--carbon-components-react.netlify.app |
✔️ Deploy Preview for carbon-elements ready! 🔨 Explore the source changes: ea40851 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/61aa48a10298910008e6e56a 😎 Browse the preview: https://deploy-preview-10205--carbon-elements.netlify.app |
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 really great work, I'm super impressed! Huge value in this one.
Just a couple questions below but ultimately LGTM 👍
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.
looks great josh! all tests pass and the implemention is really clean. Thanks for going over this earlier
); | ||
``` | ||
|
||
You can also configure it to disable specific fonts: |
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 you disable a font here do you need to enable another one by default or will the other 2 default ones just take precedent ?
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.
@aledavila great question, basically there are the three fonts that are enabled by default. If you disable one of them, the others will still be enabled.
The trick for this is in the fonts/_index.scss
file that merges our "default" fonts with the given $fonts
map:
$-default-fonts: (
IBM-Plex-Sans: true,
IBM-Plex-Serif: true,
);
// This is the variable that callers would change with `@use`
$fonts: () !default;
// Merge the two maps, prefer values in what the user gives us over our default values
$fonts: map.merge($-default-fonts, $fonts);
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.
Oh cool. Thank !
|
||
Each font is available as an entrypoint in the `fonts` folder. You can use these | ||
entrypoints to include specific font weights, styles, and more for IBM Plex. For | ||
example, if you only want to include the regular font weight for IBM Plex Sans |
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.
Should we surface the available font weights here?
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.
Good call, definitely 👍
…at/add-support-for-fonts
…bon into feat/add-support-for-fonts
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.
Looks great! Very cool to see, I've never thought about fonts before and it's awesome to officially have this in carbon now!
This PR adds in support for bringing in IBM Plex to Carbon through
scss/fonts
. This update allows teams to bundle the latest version of@ibm/plex
into their project, in particular for bundlers like webpack. It also allows teams that self-host to use our system to correctly determineurl()
values for@font-face
blocks.Overall, this PR by default allows IBM Plex Mono, Sans, Serif to be included with the light, regular, and semibold font weights. It also allows teams to include other font weights and other font families such as:
This PR does not include the following:
Changelog
New
scss/fonts
entrypoint to@carbon/styles
Changed
@carbon/styles
carbon-react
Removed
scss/_font-face.scss
Testing / Reviewing
packages/styles/scss/fonts
scss/fonts/README.md
file and make content suggestions where appropriate if something is unclear or missing from the docspackages/carbon-react
packages/styles/scss/fonts
are correctly re-exported inpackages/carbon-react/scss/fonts
Screen.Recording.2021-12-01.at.14.08.55.mov
At the end, you'll see that I noticed that IBM Plex Sans Thai was loaded incorrectly and didn't not have the correct font resource loaded