From f6bf7da1443f6add7ba83b71e4cff749f5ee8191 Mon Sep 17 00:00:00 2001 From: ElderJames Date: Wed, 11 Mar 2020 14:00:18 +0800 Subject: [PATCH] feat(module:menu): add menu-item-group --- components/menu/AntMenuItemGroup.razor | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 components/menu/AntMenuItemGroup.razor diff --git a/components/menu/AntMenuItemGroup.razor b/components/menu/AntMenuItemGroup.razor new file mode 100644 index 000000000..4c37ed359 --- /dev/null +++ b/components/menu/AntMenuItemGroup.razor @@ -0,0 +1,38 @@ +@namespace AntBlazor +@inherits AntDomComponentBase + +
  • +
    + @title +
    + @ChildContent +
  • + +@code { + + [Parameter] + public RenderFragment ChildContent { get; set; } + + [Parameter] + public string title { get; set; } + + + [CascadingParameter] + public AntMenu Menu { get; set; } + + private readonly ClassMapper titleClassMapper = new ClassMapper(); + + protected override void OnInitialized() + { + base.OnInitialized(); + this.titleClassMapper + .If("ant-dropdown-menu-item-group-title", () => !Menu.isInDropDown) + .If("ant-menu-item-group-title", () => !Menu.isInDropDown) + ; + + this.ClassMapper + .If("ant-dropdown-menu-item-group", () => Menu.isInDropDown) + .If("ant-menu-item-group", () => !Menu.isInDropDown); + } + +}