-
-
Notifications
You must be signed in to change notification settings - Fork 364
feat(Layout): add ShowTabInHeader parameter #5762
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
Reviewer's Guide by SourceryThis pull request introduces a new No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a demo to showcase the new
ShowTabInHeaderfeature. - The
LayoutHeaderclass seems very simple; consider if it's really needed or if its functionality could be merged elsewhere.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 2 issues found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| /// <summary> | ||
| /// Gets or sets before popup context menu callback. Default is null. | ||
| /// </summary> | ||
| [Parameter] |
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.
issue (complexity): Consider unifying the two layout sources into a single layout instance property to avoid branching logic in the LayoutInstance getter and simplify the code.
Consider unifying the two layout sources into a single “layout instance” property. For example, you can introduce an explicit parameter (e.g. ExplicitLayout) and a cascading parameter (e.g. CascadingLayout) and then consolidate them once per update cycle. This removes the need for a branching LayoutInstance getter. For instance:
```csharp
// Accept both sources
[Parameter]
public Layout? ExplicitLayout { get; set; }
[CascadingParameter]
public Layout? CascadingLayout { get; set; }
// Consolidated layout instance
private Layout? _layoutInstance;
protected override void OnParametersSet()
{
// Use the explicit layout if provided; otherwise use the cascading layout.
_layoutInstance = ExplicitLayout ?? CascadingLayout;
}Then, in your component, replace references to Layout or LayoutInstance with _layoutInstance:
protected override Task InvokeInitAsync() =>
InvokeVoidAsync("init", Id, Interop, nameof(DragItemCallback), _layoutInstance?.Id);
// In your RenderFragment
builder.AddAttribute(4, nameof(BootstrapBlazorAuthorizeView.Resource), _layoutInstance?.Resource);This keeps functionality intact while removing the extra indirection and branching logic.
Link issues
fixes #5761
Summary By Copilot
This pull request includes significant updates to the
LayoutandTabcomponents in theBootstrapBlazorlibrary. The main changes involve adding support for displaying tabs in the header and refactoring the components to accommodate this new feature.Enhancements to
Layoutcomponent:idattribute to the<section>element to improve element identification. ([src/BootstrapBlazor/Components/Layout/Layout.razorL10-R10](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-297066f5ecfa138159913108bba960566925628f897ea9934a7c1795e70ebd15L10-R10))ShowTabInHeaderparameter to control the display of tabs in the header. ([src/BootstrapBlazor/Components/Layout/Layout.razor.csR348-R353](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-ee1b3a15db7c9d65a5090537d506dfa83ab3bab7627022c09ee627e33c43bb12R348-R353))Layoutcomponent to include aRenderTabHeadermethod for rendering tab headers. ([src/BootstrapBlazor/Components/Layout/Layout.razor.csR637-R648](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-ee1b3a15db7c9d65a5090537d506dfa83ab3bab7627022c09ee627e33c43bb12R637-R648))Enhancements to
Tabcomponent:Tabcomponent to render tab headers conditionally based on the presence of aTabHeader. ([[1]](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-41b1c5919c2aed658650a24a6b28ecd5763566ed708ff322a9fca34e4d5fac15L43-R73),[[2]](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-41b1c5919c2aed658650a24a6b28ecd5763566ed708ff322a9fca34e4d5fac15L171-L190))Layoutparameter and refactored the component to useLayoutInstancefor better resource management. ([[1]](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-f16bfc11b19f5f5ca874276674010a254f12dcfbc065320a1be81bf91721de64R422-R429),[[2]](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-f16bfc11b19f5f5ca874276674010a254f12dcfbc065320a1be81bf91721de64R795-R796))initfunction inTab.razor.jsto handle the new layout-based tab header rendering. ([[1]](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-c4788ebe88a1c4c5c925060e09c61872a94b53d25366a8d410b51f796136de83L174-R174),[[2]](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-c4788ebe88a1c4c5c925060e09c61872a94b53d25366a8d410b51f796136de83R183-L187))New components and interfaces:
LayoutHeaderclass to manage the rendering of tab headers. ([src/BootstrapBlazor/Components/Layout/LayoutHeader.csR1-R37](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-aa8f27c0e11f1b6a07c3b570500b51176cab9e9f7f361e542abfbb3dee73c320R1-R37))ITabHeaderinterface to define the contract for tab header rendering. ([src/BootstrapBlazor/Components/Tab/ITabHeader.csR1-R18](https://github.com/dotnetcore/BootstrapBlazor/pull/5762/files#diff-561f696c2acceb79152500d8895304ccf7acd735d6a4d543a481bf53807368bfR1-R18))Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add support for displaying tabs in the header of the Layout component by introducing a new ShowTabInHeader parameter and refactoring the Tab and Layout components to enable flexible tab header rendering.
New Features:
Enhancements: