Files
decePubClient/Components/Daisy/DComponentBase.cs
T
thepraandClaude Opus 5.5 3827d903a3
Build / Build (push) Successful in 33s
House rules: numbers through one formatter, no made-up server errors, and the rules fail the build
- Every number shown on a page goes through NumbersExtensions: counts,
  percentages, the nerd readouts and the values written into a style.
- A failure the client builds itself (offline, timeout, retries run out, an
  answer it can't read) is a 400 that names its kind; only a server's own 5XX
  passes through.
- Login, sign-up, recovery and password confirmations leave autocomplete to
  the browser, so it can offer the saved login.
- The Daisy components start with empty lists and attributes, and a
  decorative image still renders alt="".
- Arasaka.HouseRules.Analyzers checks all of this in every build, together
  with PrivaPub.ClientModels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
2026-11-10 01:26:39 +01:00

28 lines
1.1 KiB
C#

using Microsoft.AspNetCore.Components;
namespace decePubClient.Components.Daisy;
/// <summary>
/// Base of the daisyUI wrappers. A consumer's <c>class</c> lands in <see cref="Class"/> and is appended after the
/// component's own classes; every other unmatched attribute is passed through to the root element.
/// </summary>
public abstract class DComponentBase : ComponentBase
{
[Parameter] public string Class { get; set; }
[Parameter(CaptureUnmatchedValues = true)] public IReadOnlyDictionary<string, object> AdditionalAttributes { get; set; } = new Dictionary<string, object>();
protected static string Cx(params string[] classes) => DCx.Join(classes);
}
public static class DCx
{
/// <summary>
/// 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 <c>DColor.Primary => "btn-primary"</c>, never assembled like <c>"btn-" + color</c>:
/// Tailwind generates only the classes it finds in .razor and .cs files.
/// </summary>
public static string Join(params string[] classes) =>
string.Join(' ', classes.Where(c => !string.IsNullOrWhiteSpace(c)));
}