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

Responsive typography helper for modifying properties #20696

Closed
1 task done
andyfangaf opened this issue Apr 22, 2020 · 6 comments
Closed
1 task done

Responsive typography helper for modifying properties #20696

andyfangaf opened this issue Apr 22, 2020 · 6 comments
Labels
duplicate This issue or pull request already exists

Comments

@andyfangaf
Copy link

andyfangaf commented Apr 22, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

Sometimes it's necessary to have an h6 with a different fontWeight than what's in the theme, but referencing it directly with theme.typography.h6.fontSize makes you lose out on responsiveness.

Possible solutions 🌈

  • Add fontWeight property to Typography
  • Add utility to get the responsive fontWeight

Motivation 🔦

No utility for responsive font sizes, unless you're using Typography which doesn't accept custom font weights :(

@oliviertassinari oliviertassinari added the duplicate This issue or pull request already exists label Apr 22, 2020
@oliviertassinari
Copy link
Member

Duplicate of #15561

@oliviertassinari oliviertassinari marked this as a duplicate of #15561 Apr 22, 2020
@andyfangaf
Copy link
Author

andyfangaf commented Apr 22, 2020

@oliviertassinari I don't think this is a duplicate of that issue, which advocates for alignment (already a solution for that). You can't do the same with font-weights, since they're fixed to the theme (can't inherit).

@oliviertassinari
Copy link
Member

From what I understand, they are some cases where you want to change the font weight, using the fontWeight prop of the system would solve your issue (it also comes with responsive helpers)

@andyfangaf
Copy link
Author

Ah I overlooked that, thank you.

Is there any reason it's not part of the Typography component API?

@andyfangaf
Copy link
Author

andyfangaf commented Apr 22, 2020

@oliviertassinari okay I gave that a try, but Typography won't inherit from Box if you've set a default in your theme. Typography has more specificity.

<Box fontWeight={500}>
  <Typography variant="h5" color="textSecondary">
     Foo
  </Typography>
</Box>

@oliviertassinari
Copy link
Member

Correct, it's what we want to solve in #15561.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants