Open Closed

Is there an ability to override MainSiderbar.razor in the Lepton Theme similar to the way that the MainFooterComponent can be overridden in the LeptonThemeOptions? #3666


User avatar
0
russel.krause@painworth.com created
  • ABP Framework version: v5.3.2
  • UI type: Blazor
  • DB provider: EF Core
  • **Tiered

Hello,

We are interested in enhancing the menu system of the Lepton theme to present/hide options in the menu based on functional (context-sensitive) logic based on more than simply role membership.

We have found MainSiderbar.razor component in the ABP Commercial Source where the following code is executed:

< nav role="navigation" class="lp-sidebar-navi" >
   < ul>
      @if (Menu != null)
       {
           @foreach (var menuItem in Menu.Items)
           {
               < MainSiderbarMenuItem Menu="@Menu" MenuItem="@menuItem"/>
           }
       }
   < /ul>
< /nav>

It is this code that we would like to over-ride. What we are hoping is that there is a mechanism to override the default behaviour of this file by replacing it with our own component, much like how we have done so to replace the MainFooterComponent by configuring the following in our Module:

Configure<Volo.Abp.AspNetCore.Components.Web.LeptonTheme.LeptonThemeOptions>(options =>
        {
            options.FooterComponent = typeof(MainFooterComponent);
        });

Our questions are these:

  • Are there any plans by ABP to extend the LeptonThemeOptions that can be made configurable to include the MainSiderbar.razor component?
  • If there are no immediate plans to extend this as an over-ridable option, what is the best approach to enhance this behaviour?

In reviewing the documentation, a "Copy & Customize" approach is suggested where, we would download and customize the Lepton Theme code. Since the Lepton theme is a very large module containing over 6-8 projects, we are disinclined to do so as that would fork our code base from the supported theme.

What would be our best approach / what are our other options to enhance the menu system?

Thank-you

Russel Krause Director of Development PainWorth.com


1 Answer(s)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, you can override a razor component without needing to download all the source code of the module. See the Blazor UI: Customization / Overriding Components to see how to override a razor component.


    Are there any plans by ABP to extend the LeptonThemeOptions that can be made configurable to include the MainSiderbar.razor component?

    Currently, we don't have any plan regarding that. Because the developer can override any razor component easily by following the Blazor UI: Customization / Overriding Components documentation.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15