Files
aliasvault/apps/server/Shared/AliasVault.RazorComponents/StatusPill.razor
2025-04-30 19:03:18 +02:00

32 lines
777 B
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";
private string PillClass => Enabled
? "bg-green-100 text-green-800"
: "bg-red-100 text-red-800";
private string StatusText => Enabled ? TextTrue : TextFalse;
}