Accounts sign-in looks like the church's site; Events sends its logo and colours
- @crosscode/ui: Shell with the church's colour wash, logo (or its initial) and name, footer; Card edged in the church's colour; Heading with an icon tile. Icons on every sign-in step. - contracts 1.9.0: churchLookSchema (logo, accent colour) in import.begin; church.branding request. Accounts fills (move) or replaces (button) the church profile's name, logo and colours. - Events 3.1.0: src/accounts/look.ts (logo as a full address), sent with a move; Settings -> Sign-in "Use this site's logo and colours". Tests: Accounts 55, contracts 218, Events 774, test:accounts 16. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+30
-11
@@ -9,30 +9,49 @@ const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).jo
|
||||
export type Branding = { name: string; shortName?: string | null; logoUrl?: string | null };
|
||||
|
||||
/** The page frame: the church's logo and name, then the content in a centred column. */
|
||||
/** 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>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The page frame (as the church's other sites): a soft wash of the church's colour, its logo and
|
||||
* 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 }) {
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col">
|
||||
<header className="bg-white border-b">
|
||||
<div className={cx("mx-auto flex items-center gap-3 px-4 py-3", wide ? "max-w-5xl" : "max-w-md")}>
|
||||
{branding.logoUrl ? <img src={branding.logoUrl} alt="" className="h-9 w-auto rounded" /> : <span className="h-9 w-9 rounded-lg bg-brand" aria-hidden />}
|
||||
<span className="font-semibold text-gray-900">{branding.name}</span>
|
||||
<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>
|
||||
{aside && <div className="ml-auto">{aside}</div>}
|
||||
</div>
|
||||
</header>
|
||||
<main className={cx("mx-auto w-full flex-1 px-4 py-8", wide ? "max-w-5xl" : "max-w-md")}>{children}</main>
|
||||
<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>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Card({ children, className }: { children: React.ReactNode; className?: string }) {
|
||||
return <div className={cx("rounded-2xl border bg-white p-6 shadow-sm", className)}>{children}</div>;
|
||||
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>;
|
||||
}
|
||||
|
||||
export function Heading({ children, sub }: { children: React.ReactNode; sub?: React.ReactNode }) {
|
||||
/** 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-5">
|
||||
<h1 className="text-xl font-semibold text-gray-900">{children}</h1>
|
||||
{sub && <p className="mt-1 text-sm text-gray-600">{sub}</p>}
|
||||
<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>}
|
||||
<div>
|
||||
<h1 className="text-xl font-semibold text-gray-900">{children}</h1>
|
||||
{sub && <p className="mt-1 text-sm text-gray-600">{sub}</p>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user