44 lines
1.2 KiB
Plaintext
44 lines
1.2 KiB
Plaintext
@inherits DComponentBase
|
|||
|
|
|
||
|
|
@* daisyUI Badge: https://daisyui.com/components/badge/ . Without ChildContent it is an empty dot. *@
|
||
|
|
<span @attributes="AdditionalAttributes" class="@CssClass">@ChildContent</span>
|
||
|
|
|
||
|
|
@code {
|
||
|
|
[Parameter] public RenderFragment ChildContent { get; set; }
|
||
|
|
[Parameter] public DColor Color { get; set; }
|
||
|
|
[Parameter] public DBadgeVariant Variant { get; set; }
|
||
|
|
[Parameter] public DSize Size { get; set; }
|
||
|
|
|
||
|
|
string CssClass => Cx("badge", ColorClass, VariantClass, SizeClass, Class);
|
||
|
|
|
||
|
|
string ColorClass => Color switch
|
||
|
|
{
|
||
|
|
DColor.Neutral => "badge-neutral",
|
||
|
|
DColor.Primary => "badge-primary",
|
||
|
|
DColor.Secondary => "badge-secondary",
|
||
|
|
DColor.Accent => "badge-accent",
|
||
|
|
DColor.Info => "badge-info",
|
||
|
|
DColor.Success => "badge-success",
|
||
|
|
DColor.Warning => "badge-warning",
|
||
|
|
DColor.Error => "badge-error",
|
||
|
|
_ => null
|
||
|
|
};
|
||
|
|
|
||
|
|
string VariantClass => Variant switch
|
||
|
|
{
|
||
|
|
DBadgeVariant.Outline => "badge-outline",
|
||
|
|
DBadgeVariant.Dash => "badge-dash",
|
||
|
|
DBadgeVariant.Soft => "badge-soft",
|
||
|
|
DBadgeVariant.Ghost => "badge-ghost",
|
||
|
|
_ => null
|
||
|
|
};
|
||
|
|
|
||
|
|
string SizeClass => Size switch
|
||
|
|
{
|
||
|
|
DSize.Xs => "badge-xs",
|
||
|
|
DSize.Sm => "badge-sm",
|
||
|
|
DSize.Lg => "badge-lg",
|
||
|
|
DSize.Xl => "badge-xl",
|
||
|
|
_ => null
|
||
|
|
};
|
||
|
|
}
|