Added voice work image fallback. Added tag/creator/circle chip components. Updated voice work search response to include favorite/blacklisted flags for tags/creators/circles.
This commit is contained in:
@@ -1,12 +1,26 @@
|
||||
@using JSMR.UI.Blazor.Enums
|
||||
|
||||
<div class="j-chip">
|
||||
@if (Graphic != null)
|
||||
{
|
||||
<Icon Graphic="@Graphic.Value" Color="@Color"></Icon>
|
||||
}
|
||||
<span>@ChildContent</span>
|
||||
</div>
|
||||
@if (string.IsNullOrWhiteSpace(Url))
|
||||
{
|
||||
<div class="@GetClasses()" @onclick="@OnClickAsync">
|
||||
@if (Graphic != null)
|
||||
{
|
||||
<Icon Graphic="@Graphic.Value" Varient="@(IconVarient ?? Enums.IconVarient.None)" Color="@Color"></Icon>
|
||||
}
|
||||
<span>@ChildContent</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a class="@GetClasses()" href="@Url" target="@Target">
|
||||
@if (Graphic != null)
|
||||
{
|
||||
<Icon Graphic="@Graphic.Value" Varient="@(IconVarient ?? Enums.IconVarient.None)" Color="@Color"></Icon>
|
||||
}
|
||||
<span>@ChildContent</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
@@ -15,6 +29,72 @@
|
||||
[Parameter]
|
||||
public Graphic? Graphic { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public IconVarient? IconVarient { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public ColorVarient Color { get; set; } = ColorVarient.Primary;
|
||||
|
||||
[Parameter]
|
||||
public ElementVarient Varient { get; set; } = ElementVarient.None;
|
||||
|
||||
[Parameter]
|
||||
public ToneVarient Tone { get; set; } = ToneVarient.None;
|
||||
|
||||
[Parameter]
|
||||
public string? Url { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string? Target { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback Click { get; set; }
|
||||
|
||||
private string GetClasses()
|
||||
{
|
||||
string color = Color.ToString().ToLower();
|
||||
|
||||
List<string> classNames =
|
||||
[
|
||||
$"j-chip",
|
||||
$"color-{color}"
|
||||
];
|
||||
|
||||
switch (Varient)
|
||||
{
|
||||
case ElementVarient.Filled:
|
||||
classNames.Add($"varient-filled");
|
||||
//classNames.Add($"background-color-{color}");
|
||||
break;
|
||||
case ElementVarient.Outlined:
|
||||
classNames.Add($"varient-outlined");
|
||||
//classNames.Add($"border-color-{color}");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (Tone)
|
||||
{
|
||||
case ToneVarient.Solid:
|
||||
classNames.Add($"tone-solid");
|
||||
break;
|
||||
case ToneVarient.Tint:
|
||||
classNames.Add($"tone-tint");
|
||||
break;
|
||||
}
|
||||
|
||||
if (Click.HasDelegate || string.IsNullOrWhiteSpace(Url) == false)
|
||||
{
|
||||
classNames.Add("is-clickable");
|
||||
}
|
||||
|
||||
return string.Join(" ", classNames);
|
||||
}
|
||||
|
||||
private async Task OnClickAsync()
|
||||
{
|
||||
if (Click.HasDelegate)
|
||||
{
|
||||
await Click.InvokeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user