// templui component badge - version: main installed by templui v0.71.0 package badge import "git.jmbit.de/jmb/scanfile/server/web/templui/utils" type Variant string const ( VariantDefault Variant = "default" VariantSecondary Variant = "secondary" VariantDestructive Variant = "destructive" VariantOutline Variant = "outline" ) type Props struct { ID string Class string Attributes templ.Attributes Variant Variant } templ Badge(props ...Props) { {{ var p Props }} if len(props) > 0 { {{ p = props[0] }} }
{ children... }
} func (p Props) variantClasses() string { switch p.Variant { case VariantDestructive: return "border-transparent bg-destructive text-destructive-foreground" case VariantOutline: return "text-foreground border-border" case VariantSecondary: return "border-transparent bg-secondary text-secondary-foreground" default: return "border-transparent bg-primary text-primary-foreground" } }