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

FluentCard work #895

Merged
merged 3 commits into from
Oct 27, 2023
Merged

FluentCard work #895

merged 3 commits into from
Oct 27, 2023

Conversation

vnbaaij
Copy link
Collaborator

@vnbaaij vnbaaij commented Oct 26, 2023

  • FluentCard: Add Width/Height. Update docs/samples
  • FluentFooter: remove width from style
  • Update WhatsNew

@vnbaaij vnbaaij requested a review from dvoituron October 26, 2023 20:35
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-895.westeurope.3.azurestaticapps.net

@vnbaaij vnbaaij merged commit bc71169 into dev Oct 27, 2023
3 checks passed
@vnbaaij vnbaaij deleted the vnbaaij/fluent-card branch October 27, 2023 09:43
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-895.westeurope.3.azurestaticapps.net

@ApacheTech
Copy link
Contributor

ApacheTech commented Nov 28, 2023

This change should probably be considered a breaking change. It adds CSS code at a very high specificity, which overrides classes added to the card.

https://github.com/microsoft/fluentui-blazor/blob/dev/src/Core/Components/Card/FluentCard.razor.css

This CSS resolves to:

fluent-card[b-6epdlk0xtt]  {
    padding: calc(var(--design-unit) * 5px);
}

Which is a much higher specificity than the classes added via the component's Class attribute, short of using !important. Using Tailwind by way of example:

@* This still has prominent padding. *@
<FluentCard Class="p-0">Hello World</FluentCard>

@* Only with the !important override does the padding get removed. *@
<FluentCard Class="!p-0">Hello World</FluentCard>

If placed within global scope, rather than in a CSS module, these styles would be overridable naturally within the cascade.

@vnbaaij
Copy link
Collaborator Author

vnbaaij commented Nov 30, 2023

We want/need a Card to look good without the developer doing anything to achieve that. We add this padding on purpose to adhere to the Fluent Design system.
If a developenr needs/wants that to be overridden and needs to use !important to achieve that, I don't see that as an issue.

@ApacheTech
Copy link
Contributor

I would agree with you, if this style was set at a global level.

With a global style, every FluentCard would inherit that standardised baseline style, and developers can override that style, using the standard CSS cascade, the way it is intended to be used.

With CSS modules, each FluentCard is set its own very specific style, rather than inheriting a global style. This breaks the cascade, and is now only overridable once, by way of !important.

This means developers cannot create their own standard, overridable baselines for components, and it reduces their re-usability as Blazor components.

It also breaks existing sites, and is not documented as doing so. FluentCards are used ubiquitously, for many purposes. They are probably one of the most commonly used components within FluenUI. A drastic, breaking change such as this should be, at the very least, documented as such. For what it's worth, I agree that a default padding is required for the cards. I just disagree with the specificity of the style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants