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

MudListItem: SecondaryText Feature #8921

Merged
merged 3 commits into from May 12, 2024
Merged

Conversation

mckaragoz
Copy link
Member

Description

Added SecondaryText parameter to MudListItem.

How Has This Been Tested?

Already using with MudListItemExtended.

20240508_143403.mp4

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

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

@github-actions github-actions bot added enhancement New feature or request PR: needs review labels May 8, 2024
@mckaragoz mckaragoz requested a review from henon May 8, 2024 11:49
Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.48%. Comparing base (28bc599) to head (418b754).
Report is 185 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8921      +/-   ##
==========================================
+ Coverage   89.82%   90.48%   +0.65%     
==========================================
  Files         412      419       +7     
  Lines       11878    12197     +319     
  Branches     2364     2381      +17     
==========================================
+ Hits        10670    11036     +366     
+ Misses        681      627      -54     
- Partials      527      534       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@if (!string.IsNullOrEmpty(SecondaryText))
{
<br />
<MudText Class="mud-list-item-secondary-text" Typo="Typo.subtitle2">@SecondaryText</MudText>
Copy link
Contributor

@Yomodo Yomodo May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I normally use mt-n or pt-n instead of br/>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not about margin or padding. Need to be sure secondary text placed on new line. In some situations text and secondary text show in one line. And there is no guarantee that MudText never be changed.

@mckaragoz
Copy link
Member Author

@henon test done.

@henon henon merged commit 9803aa2 into MudBlazor:dev May 12, 2024
4 checks passed
@henon
Copy link
Collaborator

henon commented May 12, 2024

Thanks!

@Alerinos
Copy link
Contributor

Alerinos commented May 14, 2024

@henon I was reminded that mud is missing a basic implementation of <ul> <li>.
Taking this opportunity, what do you guys think about introducing a simple implementation?

@henon
Copy link
Collaborator

henon commented May 14, 2024

@Alerinos I struggle to imagine how it should look like compared to MudList. Can you share examples from other toolkits that have what you mean?

@Alerinos
Copy link
Contributor

Alerinos commented May 14, 2024

@henon
image
I made such a thing, it is a simple list. I am missing such a component in MudBlazor.
You might want to make a new component called <MudSimpleList>?

@henon
Copy link
Collaborator

henon commented May 14, 2024

That is so simple that it is probably not worth adding this. Can't you just directly use <ul> and put <MudText> inside the <li> ?

@Alerinos
Copy link
Contributor

@henon
You can manually do it but it spoils our look and doesn't fit with the rest.
Having the Mud component everything is nicely compatible with each other, if we want to change the look of the layout everything changes nicely. We should have as many components as possible

I'm just in migration, MudList requires T parameter, shouldn't we allow nullable?
Currently this is what my code looks like:
image

@henon
Copy link
Collaborator

henon commented May 16, 2024

I'm just in migration, MudList requires T parameter, shouldn't we allow nullable?

Nullable types are allowed, for instance int?.

@Alerinos
Copy link
Contributor

@henon
image
I meant that MudList requires T, should be default value or nullable possible.

@henon
Copy link
Collaborator

henon commented May 16, 2024

I know, I would prefer that too, but Blazor doesn't allow it

@Alerinos
Copy link
Contributor

Alerinos commented May 16, 2024

@henon Can't we set a default T, or make it null?

    public partial class MudList<T> : MudComponentBase, IDisposable : this(default(T))

Alternatively, it is possible to do “overloading” and create two classes, one with T and one without. In this case, we will handle everything.

@henon
Copy link
Collaborator

henon commented May 16, 2024

@henon Can't we set a default T, or make it null?

    public partial class MudList<T> : MudComponentBase, IDisposable : this(default(T))

Is this even legal C# ?

Alternatively, it is possible to do “overloading” and create two classes, one with T and one without. In this case, we will handle everything.

We tried that too, doesn't work. This is a technical limitation of Blazor that only Microsoft can fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR: needs review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants