-
Couldn't load subscription status.
- Fork 10
Upgrading to design system react v2.4.0 #1229
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
base: main
Are you sure you want to change the base?
Conversation
|
General styling issue fixes:
In // Remove only import alert styles
// @use "../../../node_modules/@raspberrypifoundation/design-system-core/scss/components/alert.scss";
// Imports all design system styles as per https://github.com/RaspberryPiFoundation/design-system-react/blob/main/UPDATING.md
@forward "@raspberrypifoundation/design-system-react/scss/design-system-core";
Google Icon font: From what I can find online via various support post/blog posts. It does not look like Web Component easily support loading up externally hosted fonts. I'm struggling to find good documentation/guidance on this. The two solutions tend to be:
How I've got it working so far: We need 2 thing:
Do do this we can:
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<!-- Google Material Symbols fonts for design system -->
<link
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp"
rel="stylesheet"
/>
<title>Editor Web component</title>
</head>
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined");
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded");
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp");More specifically the part we actually need is shown below, but I think fetching it via the url at build time feels cleaner?: // Class for sharp icons
.material-symbols-sharp {
font-family: "Material Symbols Sharp";
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-moz-font-feature-settings: "liga";
-moz-osx-font-smoothing: grayscale;
}Other notes:
|
|
Thanks @maxelkins, that was really useful. Have it working now. I was able to just use I only added Material Symbols Sharp, since that's all we actually use, and I think we probably don't want to expand our usage of Material Symbols at this point. 😶 |
Without injecting/adding the font into the host too? From my testing both were required, the Either way, glad we've got some some resolution 👍 |
What's Changed
design-system-reacthas been upgraded to version2.4- this removes the problematic code that was being injected into the head. This caused a build failure because it was attempting to load the font from the wrong path when the design system was used in a web component.design-system-coreas this is now packaged withdesign-system-reactExternalStylesand injected into the host page, as there seems not to be a way to get the symbols to load up from within the web component. Although this is unideal, we are looking to move away from Material Symbols in the future.closes #https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/744