Skip to content

Commit

Permalink
DropdownToggle. fix toggle icon visibility on Tailwind
Browse files Browse the repository at this point in the history
  • Loading branch information
stsrki committed Nov 1, 2023
1 parent 802540a commit 2a31a45
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions Source/Blazorise.Tailwind/DropdownToggle.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
@inherits Blazorise.DropdownToggle
@using System.Text
@inherits Blazorise.DropdownToggle
<button @ref="@ElementRef" id="@ElementId" type="button" class="@ClassNames" style="@StyleNames" data-boundary="@DataBoundary" disabled="@IsDisabled" tabindex="@TabIndex" aria-expanded="@(ParentDropdownState?.Visible.ToString().ToLowerInvariant())" @onclick="@ClickHandler" @attributes="@Attributes">
<span>@ChildContent</span>
<svg class="b-dropdown-toggle-arrow ml-2 w-4 h-4" aria-hidden="true" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
</button>
<svg class="@DropdownToggleArrowClassNames" aria-hidden="true" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
</button>
@code {
string DropdownToggleArrowClassNames
{
get
{
var sb = new StringBuilder( "b-dropdown-toggle-arrow" );

if ( !IsToggleIconVisible )
{
sb.Append( " hidden" );
}

sb.Append( " w-4 h-4 ml-1" );

return sb.ToString();
}
}

/// <summary>
/// Gets or sets the reference to the parent <see cref="Bar"/> component.
/// </summary>
[CascadingParameter] protected Bar ParentBar { get; set; }
}

0 comments on commit 2a31a45

Please sign in to comment.