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

Theme: Typography defaults and documentation #3216

Merged
merged 2 commits into from
Oct 31, 2021
Merged

Theme: Typography defaults and documentation #3216

merged 2 commits into from
Oct 31, 2021

Conversation

Garderoben
Copy link
Member

@Garderoben Garderoben commented Oct 31, 2021

Description

Before when changing the default theme's typography you had to specify all property's even if you only wanted to change one of them.
Before example:

Typography = new Typography()
{
    Default = new Default()
    {
        FontFamily = new[] { "Robot", "Helvetica", "Arial", "sans-serif" },
        FontSize = ".875rem",
        FontWeight = 400,
        LineHeight = 1.43,
        LetterSpacing = ".01071em"
    },
    H1 =.....

And if you wanted the change the font from Robot to something else you had to do it for all types Default, H1, H2 etc..
Now its possible to only change the one you actually want to change, and all typos use the Default typos FontFamily unless specified, this way you don't have to change it on all 14.

Typography = new Typography()
{
    Default = new Default()
    {
        FontFamily = new[] { "Poppins", "Helvetica", "Arial", "sans-serif" }
    }

I also added some basic documentation on how to change the theme's typography in the customization/theming section of docs.

I implemented this so it would not break current behavior or break any user code even if they have custom theming fonts already.

resolves #2234
fixes #2787

Checklist:

✔️ The PR is submitted to the correct branch (dev).
✔️ My code follows the code style of this project.
✔️ I've added relevant tests.

Typography now provides all values as default so you don't have to specify all of them if you just want to change one value. All typos use the default font typo if not set.
@Garderoben Garderoben added this to the 5.2.0 milestone Oct 31, 2021
@mudbot mudbot bot added enhancement New feature or request needs review labels Oct 31, 2021
@codecov
Copy link

codecov bot commented Oct 31, 2021

Codecov Report

Merging #3216 (2fe4ff6) into dev (6b44a0e) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #3216      +/-   ##
==========================================
- Coverage   88.52%   88.51%   -0.02%     
==========================================
  Files         289      289              
  Lines       12872    12859      -13     
==========================================
- Hits        11395    11382      -13     
  Misses       1477     1477              
Impacted Files Coverage Δ
...Components/ThemeProvider/MudThemeProvider.razor.cs 96.95% <100.00%> (ø)
src/MudBlazor/Themes/Models/Typography.cs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b44a0e...2fe4ff6. Read the comment docs.

@Garderoben Garderoben added docs Related to docs and removed needs review labels Oct 31, 2021
@Garderoben Garderoben merged commit b0d541d into MudBlazor:dev Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Related to docs enhancement New feature or request
Projects
None yet
1 participant