Blazorise icon indicating copy to clipboard operation
Blazorise copied to clipboard

Combined BarDropdown and BarLink

Open njannink opened this issue 3 years ago • 5 comments

Our UI designer has come up with the following idea:

image

This is like a combined bar dropdown and link. When you click the little arrow the idea is that the menu expands and when you click the label or icon you should be taken to the root help page. The contents of the dropdown are sub pages.

Would something like this be possible with the current Blazorise sidebar?

njannink avatar Nov 30 '21 18:11 njannink

In theory, should be possible. At the moment the toggle icon is done with CSS.

image

To make it as you suggested we would have to split it into a separate element so that it can be clickable. Also, it will need to be opt-in with a parameter flag, possibly an enum.

I will make it part of v1 and investigate further.

stsrki avatar Nov 30 '21 18:11 stsrki

I found something that seems to work fine

<BarLink To="/help" Clicked="@(() => Toggle(true))">
    <BarIcon IconName="IconNames.Help" /> Help
    <div class="ml-auto" @onclick:stopPropagation @onclick:preventDefault>
        <IconButton IconName="@(m_visible ? IconNames.ExpandLess : IconNames.ExpandMore)" 
                    Clicked="@(() => Toggle(!_visible))" />
    </div>
</BarLink>

<BarDropdown Visible="@_visible">
    <BarDropdownMenu>...</BarDropdownMenu>
</BarDropdown>

@code {
    private bool _visible;

    private void Toggle(bool visible)
    {
        _visible = visible;
    }
}

njannink avatar Nov 30 '21 18:11 njannink

@stsrki input and suggestions are welcome

njannink avatar Nov 30 '21 18:11 njannink

Seems like a good approach. We'll probably do something similar. It needs to work for all providers.

stsrki avatar Nov 30 '21 19:11 stsrki

This is exactly what I was going to post about, this could be great for implementation

nove1398 avatar Dec 02 '21 08:12 nove1398

Moving to Backlog.

stsrki avatar Jun 03 '23 15:06 stsrki

As I also frequently use this "feature"...

I do it as follows:

<BarDropdown>
<BarDropdownToggle>
<a style="color: black; text-decoration: none" href="/linkToMenuEntry">MenuEntry</a>
</BarDropdownToggle>
<BarDropdownMenu>
    <BarDropdownItem To="linkToSubMenuEntry">
    SubMenuEntry
    </BarDropdownItem>
</BarDropdownMenu>
</BarDropdown>

ofc color has to be the correct color for the used theme colors

oaldrian avatar Jun 03 '23 19:06 oaldrian