blazorbootstrap icon indicating copy to clipboard operation
blazorbootstrap copied to clipboard

Feedback: Sidebar & Sidebar2 Components

Open gvreddy04 opened this issue 3 months ago • 3 comments

Please add your feedback or proposal, along with the benefits of that approach. If you want to vote on any of the comments, please thumbs-up.

gvreddy04 avatar Mar 18 '24 04:03 gvreddy04

Hi @gvreddy04, thanks for your feedback. I try to answer it as best as I can.

@MarvinKlein1508 Sidebar implemented with the Id and ParentId approach. First, we want to maintain the same consistency for Sidebar2 so that people can switch without any extra code changes.

I thought the main point of Sidebar2 is to introduce breaking changes.

Second, some people might persist NavItem (or user privileges) in the database. This is where the implementation began.

I still don't get what's the benefit here. I mean you literally can serialize the NavItem itself to JSON or XML when you want to store it in the database. I still think that adding an Id and ParentId results in a lot of hard to maintain boilerplate code. It would be way easier to maintain when you NavItem contains a List<NavItem with all the childs.

When I want to check for permissions in ASP.NET Core you usually use rules and check them. For example: https://github.com/MarvinKlein1508/BlazorForms/blob/a69e809f6d4430445819fc60aeb5f40f1b332ad5/BlazorForms/Components/Layout/MainLayout.razor.cs#L51

Performance-wise, we will revisit Sidebar and Sidebar2 in the next release. You raised a concern with this approach. I'm not opposed to your feedback. I'll see about providing an option to input data in two formats. I'll create a Feedback issue; please add your proposal and its benefits.

Also, mention in your case whether you are providing dynamic or static data.

In my case I use a mix of both. I have an override method which generates IEnumerable<NavItem>. Some pages use a different layout which overrites the menu with different items (works great). And I check the permissions from database as stated above.

MarvinKlein1508 avatar Mar 18 '24 12:03 MarvinKlein1508

Add sticky Sidebar2 (and Sidebar if it isn't already), for mobile screens. And add sticky top-row.

Or an option to enable/disable it as Parameter.

dmm-l-mediehus avatar Apr 02 '24 06:04 dmm-l-mediehus

Add sticky Sidebar2 (and Sidebar if it isn't already), for mobile screens. And add sticky top-row.

Or an option to enable/disable it as Parameter.

@dmm-l-mediehus In Mobile:

image

image

gvreddy04 avatar Apr 03 '24 05:04 gvreddy04