-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MudAppBar: Add contextual action bar implementation #10210
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #10210 +/- ##
==========================================
+ Coverage 91.21% 91.22% +0.01%
==========================================
Files 411 414 +3
Lines 12506 12547 +41
Branches 2439 2449 +10
==========================================
+ Hits 11407 11446 +39
- Misses 555 557 +2
Partials 544 544 ☔ View full report in Codecov by Sentry. |
Looks cool! Is it possible to avoid the duplication of the |
I thought about that, but if I take it out of the |
Would using builder syntax work to move the definition to the code behind and reuse it that way? Not very familiar with SectionContent |
Looked at that too but I was getting an error when it attempted to render the builder (that could have fully been on my doing something wrong though). |
src/MudBlazor/Components/AppBar/MudContextualActionBar.razor.cs
Outdated
Show resolved
Hide resolved
Could we do something like this to avoid duplication? @if (Bottom)
{
@if(Contextual)
{
<SectionOutlet SectionId="MudAppBar.ContextualActionBar" />
<SectionContent SectionId="MudAppBar.ContextualActionBar">
@Footer
</SectionContent>
}
else
{
@Footer
}
}
else
{
@if(Contextual)
{
<SectionOutlet SectionId="MudAppBar.ContextualActionBar" />
<SectionContent SectionId="MudAppBar.ContextualActionBar">
@Header
</SectionContent>
}
else
{
@Header
}
}
@code {
private RenderFragment Header =>
@<header @attributes="UserAttributes" class="@Classname" style="@Style">
<MudToolBar Dense="@Dense" Gutters="@Gutters" Class="@ToolBarClassname" WrapContent="@WrapContent">
@ChildContent
</MudToolBar>
</header>;
private RenderFragment Footer =>
@<footer @attributes="UserAttributes" class="@Classname" style="@Style">
<MudToolBar Dense="@Dense" Gutters="@Gutters" Class="@ToolBarClassname" WrapContent="@WrapContent">
@ChildContent
</MudToolBar>
</footer>;
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like mud-appbar
is a footer
in the docs example and becomes a header
when it changes to the green form
Left a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reduced to just: @if (Contextual)
{
<SectionOutlet SectionId="@ContextualActionBar" />
<SectionContent SectionId="@ContextualActionBar">
@(Bottom ? Footer : Header)
</SectionContent>
}
else
{
@(Bottom ? Footer : Header)
} if ya all don't mind |
|
Thanks |
Description
Adds a possible contextual action bar implementation using Blazor Sections.
Contextual
toMudAppBar
SectionOutlet
or not.Contextual App Bar
section (with working example) in theApp Bar
documentation pageUserAttributesTests
as nothing is rendered until the specifiedVisible
condition is met.UserAttributes
inherited fromMudAppBar
function as expectedResolves #104
How Has This Been Tested?
Screen.Recording.2024-11-08.092917.mp4
Type of Changes
Checklist
dev
).