mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-02-19 07:28:47 -05:00
55 lines
1.4 KiB
Plaintext
55 lines
1.4 KiB
Plaintext
@inherits ComponentBase
|
|
|
|
<span class="@PillClass px-2 py-1 text-xs font-medium rounded-full">
|
|
@StatusText
|
|
</span>
|
|
|
|
@code {
|
|
/// <summary>
|
|
/// Set to true to show the pill as enabled.
|
|
/// </summary>
|
|
[Parameter]
|
|
public bool Enabled { get; set; }
|
|
|
|
/// <summary>
|
|
/// The text to show when the pill is enabled.
|
|
/// </summary>
|
|
[Parameter]
|
|
public string TextTrue { get; set; } = "Enabled";
|
|
|
|
/// <summary>
|
|
/// The text to show when the pill is disabled.
|
|
/// </summary>
|
|
[Parameter]
|
|
public string TextFalse { get; set; } = "Disabled";
|
|
|
|
/// <summary>
|
|
/// Optional color override: "green", "yellow", "red". If not specified, uses Enabled parameter.
|
|
/// </summary>
|
|
[Parameter]
|
|
public string? Color { get; set; }
|
|
|
|
private string PillClass
|
|
{
|
|
get
|
|
{
|
|
if (!string.IsNullOrEmpty(Color))
|
|
{
|
|
return Color.ToLower() switch
|
|
{
|
|
"green" => "bg-green-100 text-green-800",
|
|
"yellow" => "bg-yellow-100 text-yellow-800",
|
|
"red" => "bg-red-100 text-red-800",
|
|
_ => "bg-gray-100 text-gray-800"
|
|
};
|
|
}
|
|
|
|
return Enabled
|
|
? "bg-green-100 text-green-800"
|
|
: "bg-red-100 text-red-800";
|
|
}
|
|
}
|
|
|
|
private string StatusText => Enabled ? TextTrue : TextFalse;
|
|
}
|