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

[examples] Fix material-next-app-router Font Usage with next/font #38026

Merged
merged 1 commit into from
Jul 20, 2023
Merged

[examples] Fix material-next-app-router Font Usage with next/font #38026

merged 1 commit into from
Jul 20, 2023

Conversation

onderonur
Copy link
Contributor

This PR aims to align all the used font-family styles of MUI components when next/font is used.

With the current approach, className which contains font-family from next/font is added to body and the font-family from next/font is applied to generic HTML elements.

But MUI components still use the default font-family from theme and since we don't install Roboto font with CDN etc., they don't use this font and they fall back to next fonts like Helvetica.

For example, we can check the "On This Page" text. It is a Typography component and it uses the default "Roboto", "Helvetiva", "Arial", sans-serif font-family even if we set the className of body.
image

But after this change, it will start using --font-roboto CSS variable, which we got from next/font and set on html element.
image
image

And here are the fullpage screenshots.

Before:
image

After:
image

@mui-bot
Copy link

mui-bot commented Jul 18, 2023

Netlify deploy preview

https://deploy-preview-38026--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 1e2aef9

@zannager zannager added examples Relating to /examples customization: css Design CSS customizability labels Jul 19, 2023
@zannager zannager requested a review from mj12albert July 19, 2023 09:08
@mj12albert mj12albert changed the title Fix material-next-app-router Font Usage with next/font [examples] Fix material-next-app-router Font Usage with next/font Jul 19, 2023
@mj12albert
Copy link
Member

@onderonur Nice catch ~ thanks for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work examples Relating to /examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants