using Microsoft.AspNetCore.Components; namespace decePubClient.Components.Daisy; /// /// Base of the daisyUI wrappers. A consumer's class lands in and is appended after the /// component's own classes; every other unmatched attribute is passed through to the root element. /// public abstract class DComponentBase : ComponentBase { [Parameter] public string Class { get; set; } [Parameter(CaptureUnmatchedValues = true)] public IReadOnlyDictionary AdditionalAttributes { get; set; } protected static string Cx(params string[] classes) => DCx.Join(classes); } public static class DCx { /// /// Joins the non-empty class names. Every daisyUI class handed to it must be written out whole somewhere in the /// source, e.g. a switch arm DColor.Primary => "btn-primary", never assembled like "btn-" + color: /// Tailwind generates only the classes it finds in .razor and .cs files. /// public static string Join(params string[] classes) => string.Join(' ', classes.Where(c => !string.IsNullOrWhiteSpace(c))); }