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

Layout = "top" with RightContentRender #67

Open
michaelcsikos opened this issue Mar 17, 2023 · 5 comments
Open

Layout = "top" with RightContentRender #67

michaelcsikos opened this issue Mar 17, 2023 · 5 comments

Comments

@michaelcsikos
Copy link

Hi @ElderJames when Layout = "top" the RightContentRender is ignored. How can we get this to work?

@michaelcsikos
Copy link
Author

OK, it looks like we have to use <HeaderContentRender> with <Menu> instead of MenuData.

@Aamirkhan10218
Copy link

hi @michaelcsikos have you fixed this issue . is there any workaround available?

@michaelcsikos
Copy link
Author

michaelcsikos commented Feb 24, 2024

Hi @Aamirkhan10218

This is what worked for me:

<AntDesign.ProLayout.BasicLayout>
    <HeaderContentRender>
        <MenuDark Mode = "MenuMode.Horizontal" MenuData = "MenuData" />
    </HeaderContentRender>
    <RightContentRender>
        <RightContent />
    </RightContentRender>
    <ChildContent>
        @Body
    </ChildContent>
</AntDesign.ProLayout.BasicLayout>

@code
{
    private MenuDataItem[] MenuData { get; set; } = { };

    protected async override Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        var list  = new List<MenuDataItem>();

       // Set up menu options based on current user privileges, etc

        var menuContacts = new MenuDataItem
        {
            Path = "/contact/list",
            Name = "Contacts",
            Key  = "Contacts",
            Icon = "team",

            Children = new[]
            {
                new MenuDataItem
                {
                    Path = "/contact/list",
                    Name = "All contacts",
                    Key  = "All contacts",
                },
                new MenuDataItem
                {
                    Path = "/contact/list/staff",
                    Name = "Staff",
                    Key  = "Staff",
                },
                new MenuDataItem
                {
                    Path = "/contact/list/customer",
                    Name = "Customers",
                    Key  = "Customers",
                },
            },
        };

        list.Add(menuContacts);

        MenuData = list.ToArray();
    }
}

@Aamirkhan10218
Copy link

@michaelcsikos could you please mention you Ant Design version because I am unable to find MenuDark?

@michaelcsikos
Copy link
Author

@Aamirkhan10218 Oh, sorry, that's one of my razor files. It just sets the NavTheme = MenuTheme.Dark as follows:

@* MenuDark.razor *@

@inherits BaseMenu
@{
    base.BuildRenderTree(__builder);
}

@code
{
    protected override void OnInitialized()
    {
        NavTheme = MenuTheme.Dark;

        base.OnInitialized();
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants