Accounts 1.7.0 + @crosscode/ui 0.2.0: brand style, the church's fonts and footer, church.update
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+18
-13
@@ -4,6 +4,8 @@
|
||||
*/
|
||||
import React from "react";
|
||||
|
||||
export * from "./brand";
|
||||
|
||||
const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).join(" ");
|
||||
|
||||
export type Branding = { name: string; shortName?: string | null; logoUrl?: string | null };
|
||||
@@ -12,8 +14,8 @@ export type Branding = { name: string; shortName?: string | null; logoUrl?: stri
|
||||
/** The church's logo, or its first letter on its colour while it has none. */
|
||||
export function ChurchMark({ branding, size = "md" }: { branding: Branding; size?: "md" | "lg" }) {
|
||||
const box = size === "lg" ? "h-14 w-14 text-2xl" : "h-10 w-10 text-lg";
|
||||
if (branding.logoUrl) return <img src={branding.logoUrl} alt="" className={cx(size === "lg" ? "h-14" : "h-10", "w-auto max-w-[12rem] rounded-xl object-contain")} />;
|
||||
return <span className={cx(box, "flex shrink-0 items-center justify-center rounded-xl bg-brand font-semibold text-white")} aria-hidden>{(branding.shortName || branding.name || "?").trim().charAt(0).toUpperCase()}</span>;
|
||||
if (branding.logoUrl) return <img src={branding.logoUrl} alt="" className={cx(size === "lg" ? "h-14" : "h-10", "w-auto max-w-[12rem] rounded-[var(--cc-radius-sm,0.75rem)] object-contain")} />;
|
||||
return <span className={cx(box, "flex shrink-0 items-center justify-center rounded-[var(--cc-radius-sm,0.75rem)] bg-brand font-semibold text-white")} aria-hidden>{(branding.shortName || branding.name || "?").trim().charAt(0).toUpperCase()}</span>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,35 +23,38 @@ export function ChurchMark({ branding, size = "md" }: { branding: Branding; size
|
||||
* name across the top, the content in a centred column, and a quiet footer. `wide` for the account
|
||||
* and admin pages; otherwise a sign-in column.
|
||||
*/
|
||||
export function Shell({ branding, children, wide = false, aside }: { branding: Branding; children: React.ReactNode; wide?: boolean; aside?: React.ReactNode }) {
|
||||
/** `footer` replaces the quiet line at the bottom (Accounts 1.7.0 passes the `ChurchFooter`). */
|
||||
export function Shell({ branding, children, wide = false, aside, footer }: { branding: Branding; children: React.ReactNode; wide?: boolean; aside?: React.ReactNode; footer?: React.ReactNode }) {
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col bg-gradient-to-br from-brand/10 via-white to-brand/5">
|
||||
<header className="border-b border-brand/10 bg-white/90 backdrop-blur">
|
||||
<div className="mx-auto flex max-w-5xl items-center gap-3 px-4 py-3">
|
||||
<ChurchMark branding={branding} />
|
||||
<span className="text-lg font-semibold text-brand-dark">{branding.name}</span>
|
||||
<span className="text-lg font-semibold text-brand-dark [font-family:var(--cc-font-heading,inherit)] [font-variation-settings:var(--cc-heading-variation,normal)]">{branding.name}</span>
|
||||
{aside && <div className="ml-auto">{aside}</div>}
|
||||
</div>
|
||||
</header>
|
||||
<main className={cx("mx-auto w-full flex-1 px-4", wide ? "max-w-5xl py-8" : "max-w-md py-10 sm:py-16")}>{children}</main>
|
||||
<footer className="px-4 py-6 text-center text-xs text-gray-500">
|
||||
{branding.name} · your church account, for all its sites and apps
|
||||
</footer>
|
||||
{footer ?? (
|
||||
<footer className="px-4 py-6 text-center text-xs text-gray-500">
|
||||
{branding.name} · your church account, for all its sites and apps
|
||||
</footer>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Card({ children, className }: { children: React.ReactNode; className?: string }) {
|
||||
return <div className={cx("rounded-2xl border border-gray-200 border-t-4 border-t-brand bg-white p-6 shadow-sm sm:p-8", className)}>{children}</div>;
|
||||
return <div className={cx("rounded-[var(--cc-radius,1rem)] border border-gray-200 border-t-4 border-t-brand bg-white p-6 shadow-sm sm:p-8", className)}>{children}</div>;
|
||||
}
|
||||
|
||||
/** A page's title, with an optional icon in a tile of the church's colour (as on the church's other sites). */
|
||||
export function Heading({ children, sub, icon }: { children: React.ReactNode; sub?: React.ReactNode; icon?: React.ReactNode }) {
|
||||
return (
|
||||
<div className="mb-6 flex items-start gap-3">
|
||||
{icon && <span className="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-brand/10 text-brand" aria-hidden>{icon}</span>}
|
||||
{icon && <span className="flex h-11 w-11 shrink-0 items-center justify-center rounded-[var(--cc-radius-sm,0.75rem)] bg-brand/10 text-brand" aria-hidden>{icon}</span>}
|
||||
<div>
|
||||
<h1 className="text-xl font-semibold text-gray-900">{children}</h1>
|
||||
<h1 className="text-xl font-semibold text-gray-900 [font-family:var(--cc-font-heading,inherit)] [font-variation-settings:var(--cc-heading-variation,normal)]">{children}</h1>
|
||||
{sub && <p className="mt-1 text-sm text-gray-600">{sub}</p>}
|
||||
</div>
|
||||
</div>
|
||||
@@ -66,7 +71,7 @@ export function Button({ variant = "primary", busy, className, children, disable
|
||||
link: "text-brand underline px-0 py-0",
|
||||
}[variant];
|
||||
return (
|
||||
<button {...rest} disabled={disabled || busy} className={cx("rounded-lg px-4 py-2.5 text-sm font-medium transition disabled:opacity-50", styles, className)}>
|
||||
<button {...rest} disabled={disabled || busy} className={cx("rounded-[var(--cc-radius-button,0.5rem)] px-4 py-2.5 text-sm font-medium transition disabled:opacity-50", styles, className)}>
|
||||
{busy ? "Please wait…" : children}
|
||||
</button>
|
||||
);
|
||||
@@ -83,7 +88,7 @@ export function Field({ label, error, hint, id, className, ...rest }: FieldProps
|
||||
id={fieldId}
|
||||
aria-invalid={!!error}
|
||||
aria-describedby={error ? `${fieldId}-error` : undefined}
|
||||
className={cx("w-full rounded-lg border px-3 py-2.5 text-base focus:outline-none focus:ring-2 focus:ring-brand/50", error ? "border-red-500" : "border-gray-300")}
|
||||
className={cx("w-full rounded-[var(--cc-radius-sm,0.5rem)] border px-3 py-2.5 text-base focus:outline-none focus:ring-2 focus:ring-brand/50", error ? "border-red-500" : "border-gray-300")}
|
||||
{...rest}
|
||||
/>
|
||||
{hint && !error && <p className="mt-1 text-xs text-gray-500">{hint}</p>}
|
||||
@@ -106,5 +111,5 @@ export function Checkbox({ label, hint, ...rest }: React.InputHTMLAttributes<HTM
|
||||
|
||||
export function Notice({ tone = "info", children }: { tone?: "info" | "error" | "success" | "warning"; children: React.ReactNode }) {
|
||||
const styles = { info: "bg-blue-50 text-blue-900 border-blue-200", error: "bg-red-50 text-red-800 border-red-200", success: "bg-green-50 text-green-800 border-green-200", warning: "bg-amber-50 text-amber-900 border-amber-200" }[tone];
|
||||
return <div role={tone === "error" ? "alert" : "status"} className={cx("mb-4 rounded-lg border px-4 py-3 text-sm", styles)}>{children}</div>;
|
||||
return <div role={tone === "error" ? "alert" : "status"} className={cx("mb-4 rounded-[var(--cc-radius-sm,0.5rem)] border px-4 py-3 text-sm", styles)}>{children}</div>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user