Site design → Style: fonts, corners, text size, shadows, page width
A new Style card in Site design (a `style` global) chooses the heading and body fonts from 15 bundled ones, corners (sharp/soft/round), text size, shadow strength and page width, with a live sample. The choices become --site-* CSS variables that the @theme radius, shadow, container and font tokens scale, so blocks keep using rounded-xl, shadow-sm, max-w-6xl and follow the setting. Buttons and chips use rounded-button; the defaults are the site's current look. Fonts are @fontsource-variable packages (replacing the static DM Sans and Playfair ones): still served by the site, and a browser downloads only the fonts a page uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
parent
c35f9a60cc
commit
91f6705899
29 changed files with 628 additions and 110 deletions
|
|
@ -3,9 +3,28 @@
|
|||
themes: light --default;
|
||||
}
|
||||
|
||||
/* Site design → Style sets the --site-* variables (siteStyleVars in
|
||||
$shared/theme) on the public site and the admin preview; without them
|
||||
(the admin's own pages) every token below is its usual value. Corners,
|
||||
shadows and widths are scaled here, so blocks just use rounded-xl,
|
||||
shadow-sm, max-w-6xl… Buttons and chips use rounded-button (a pill when
|
||||
Round); dots and avatars stay rounded-full. */
|
||||
@theme {
|
||||
--font-sans: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
|
||||
--font-serif: 'Playfair Display', Georgia, serif;
|
||||
--font-sans: var(--site-font-body, 'DM Sans Variable', ui-sans-serif, system-ui, sans-serif);
|
||||
--font-serif: var(--site-font-heading, 'Playfair Display Variable', Georgia, serif);
|
||||
--radius-lg: calc(0.5rem * var(--site-corners, 1));
|
||||
--radius-xl: calc(0.75rem * var(--site-corners, 1));
|
||||
--radius-2xl: calc(1rem * var(--site-corners, 1));
|
||||
--radius-card: calc(1.25rem * var(--site-corners, 1));
|
||||
--radius-panel: calc(2rem * var(--site-corners, 1));
|
||||
--radius-button: var(--site-button-radius, 9999px);
|
||||
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / calc(0.1 * var(--site-shadow, 1))), 0 1px 2px -1px rgb(0 0 0 / calc(0.1 * var(--site-shadow, 1)));
|
||||
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / calc(0.1 * var(--site-shadow, 1))), 0 2px 4px -2px rgb(0 0 0 / calc(0.1 * var(--site-shadow, 1)));
|
||||
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / calc(0.1 * var(--site-shadow, 1))), 0 4px 6px -4px rgb(0 0 0 / calc(0.1 * var(--site-shadow, 1)));
|
||||
--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / calc(0.1 * var(--site-shadow, 1))), 0 8px 10px -6px rgb(0 0 0 / calc(0.1 * var(--site-shadow, 1)));
|
||||
--container-3xl: calc(48rem * var(--site-width, 1));
|
||||
--container-6xl: calc(72rem * var(--site-width, 1));
|
||||
--container-7xl: calc(80rem * var(--site-width, 1));
|
||||
--color-warm: var(--color-bg, #faf8f5);
|
||||
--color-charcoal: var(--color-heading, #2c2c2c);
|
||||
--color-sage: var(--color-primary, #8a9a7b);
|
||||
|
|
@ -44,7 +63,9 @@
|
|||
--fg-body: var(--color-text, #2c2c2c);
|
||||
background: var(--color-bg, #faf8f5);
|
||||
color: var(--fg-body);
|
||||
font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
|
||||
font-family: var(--font-sans);
|
||||
/* Site design → Style → Text size; rem-sized spacing grows with it. */
|
||||
font-size: var(--site-text-size, 100%);
|
||||
}
|
||||
|
||||
/* ── Foreground colour utilities (set per-block via BackgroundWrapper) ── */
|
||||
|
|
@ -74,7 +95,7 @@ h1,
|
|||
h2,
|
||||
h3,
|
||||
h4 {
|
||||
font-family: 'Playfair Display', Georgia, serif;
|
||||
font-family: var(--font-serif);
|
||||
color: var(--fg-heading, #2c2c2c);
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +135,7 @@ h4 {
|
|||
margin: 0.75rem 0;
|
||||
padding-left: 1.25rem;
|
||||
border-left: 3px solid var(--color-primary, #8a9a7b);
|
||||
font-family: 'Playfair Display', Georgia, serif;
|
||||
font-family: var(--font-serif);
|
||||
font-size: 1.35rem;
|
||||
font-style: italic;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@
|
|||
<div class="flex shrink-0 items-center gap-2 md:gap-3">
|
||||
{#if hasItems}
|
||||
<a
|
||||
class="relative flex items-center gap-2 rounded-full border border-charcoal/10 px-3 py-2 text-sm font-semibold text-charcoal/80 transition hover:border-sage hover:text-sage-dark md:px-4"
|
||||
class="relative flex items-center gap-2 rounded-button border border-charcoal/10 px-3 py-2 text-sm font-semibold text-charcoal/80 transition hover:border-sage hover:text-sage-dark md:px-4"
|
||||
href={links.basket}
|
||||
aria-label="View your basket ({basket.count})"
|
||||
>
|
||||
|
|
@ -74,10 +74,10 @@
|
|||
</a>
|
||||
{/if}
|
||||
{#if header.ctaButton?.label}
|
||||
<a class="cta btn hidden rounded-full border-0 px-6 hover:opacity-90 md:inline-flex" href={links.booking}>{header.ctaButton.label}</a>
|
||||
<a class="cta btn hidden rounded-button border-0 px-6 hover:opacity-90 md:inline-flex" href={links.booking}>{header.ctaButton.label}</a>
|
||||
{/if}
|
||||
<button
|
||||
class="grid h-10 w-10 place-items-center rounded-full text-charcoal/80 transition hover:bg-charcoal/5 md:hidden"
|
||||
class="grid h-10 w-10 place-items-center rounded-button text-charcoal/80 transition hover:bg-charcoal/5 md:hidden"
|
||||
type="button"
|
||||
aria-label="Open menu"
|
||||
aria-haspopup="dialog"
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
<div class="flex h-full flex-col">
|
||||
<div class="flex items-center justify-between border-b border-charcoal/10 px-6 py-4">
|
||||
<span class="font-serif text-xl font-bold text-charcoal">Menu</span>
|
||||
<button class="grid h-10 w-10 place-items-center rounded-full text-charcoal/80 transition hover:bg-charcoal/5" type="button" aria-label="Close menu" onclick={closeMenu}>
|
||||
<button class="grid h-10 w-10 place-items-center rounded-button text-charcoal/80 transition hover:bg-charcoal/5" type="button" aria-label="Close menu" onclick={closeMenu}>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true">
|
||||
<path stroke-linecap="round" d="M6 6l12 12M18 6L6 18" />
|
||||
</svg>
|
||||
|
|
@ -129,7 +129,7 @@
|
|||
|
||||
{#if header.ctaButton?.label}
|
||||
<div class="border-t border-charcoal/10 p-6">
|
||||
<a class="cta btn btn-block rounded-full border-0 hover:opacity-90" href={links.booking}>{header.ctaButton.label}</a>
|
||||
<a class="cta btn btn-block rounded-button border-0 hover:opacity-90" href={links.booking}>{header.ctaButton.label}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
|||
19
app-public/src/lib/fonts.ts
Normal file
19
app-public/src/lib/fonts.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// The fonts Site design → Style offers (SITE_FONTS in $shared/theme), bundled
|
||||
// and served by this app, not loaded from Google: a Google Fonts request sends
|
||||
// every visitor's IP address to Google (GDPR). Each import only declares the
|
||||
// font; a browser downloads the files of the fonts a page actually uses.
|
||||
import '@fontsource-variable/playfair-display';
|
||||
import '@fontsource-variable/cormorant-garamond';
|
||||
import '@fontsource-variable/eb-garamond';
|
||||
import '@fontsource-variable/libre-baskerville';
|
||||
import '@fontsource-variable/lora';
|
||||
import '@fontsource-variable/fraunces';
|
||||
import '@fontsource-variable/dm-sans';
|
||||
import '@fontsource-variable/inter';
|
||||
import '@fontsource-variable/manrope';
|
||||
import '@fontsource-variable/montserrat';
|
||||
import '@fontsource-variable/nunito';
|
||||
import '@fontsource-variable/outfit';
|
||||
import '@fontsource-variable/raleway';
|
||||
import '@fontsource-variable/work-sans';
|
||||
import '@fontsource-variable/josefin-sans';
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { defaultColors, defaultFooter, defaultHeader } from '$lib/types';
|
||||
import { defaultColors, defaultFooter, defaultHeader, defaultStyle } from '$lib/types';
|
||||
import type { ItemRecord } from '$lib/types';
|
||||
import { BASKET_COOKIE, getBasket } from '$lib/server/shop';
|
||||
import { loadShopData } from '$shared/server/shop';
|
||||
|
|
@ -21,10 +21,11 @@ export const load: LayoutServerLoad = async ({ locals, cookies, url }) => {
|
|||
// Shop blocks fetch bookable times themselves (GET /api/slots).
|
||||
void url.pathname;
|
||||
|
||||
const [header, footer, colors] = await Promise.all([
|
||||
const [header, footer, colors, style] = await Promise.all([
|
||||
getGlobal(locals.pb, 'header', defaultHeader),
|
||||
getGlobal(locals.pb, 'footer', defaultFooter),
|
||||
getGlobal(locals.pb, 'colors', defaultColors)
|
||||
getGlobal(locals.pb, 'colors', defaultColors),
|
||||
getGlobal(locals.pb, 'style', defaultStyle)
|
||||
]);
|
||||
|
||||
if (!header.homePage) header.homePage = defaultHeader.homePage;
|
||||
|
|
@ -47,5 +48,5 @@ export const load: LayoutServerLoad = async ({ locals, cookies, url }) => {
|
|||
// Prices are shown in the currency Stripe charges in.
|
||||
const currency = shopCurrency(env.STRIPE_CURRENCY);
|
||||
|
||||
return { header, footer, colors, user: locals.user, basket, items, timezone, currency };
|
||||
return { header, footer, colors, style, user: locals.user, basket, items, timezone, currency };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,6 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
// Fonts are bundled and served by this app, not loaded from Google: a
|
||||
// Google Fonts request sends every visitor's IP address to Google (GDPR).
|
||||
import '@fontsource/dm-sans/400.css';
|
||||
import '@fontsource/dm-sans/500.css';
|
||||
import '@fontsource/dm-sans/600.css';
|
||||
import '@fontsource/dm-sans/700.css';
|
||||
import '@fontsource/playfair-display/600.css';
|
||||
import '@fontsource/playfair-display/700.css';
|
||||
import '$lib/fonts';
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
import Header from '$lib/components/Header.svelte';
|
||||
import Footer from '$lib/components/Footer.svelte';
|
||||
|
|
@ -35,9 +28,9 @@
|
|||
<!-- Home-screen icon on phones; iOS ignores SVG, so only for an uploaded logo. -->
|
||||
{#if icon !== favicon}<link rel="apple-touch-icon" href={icon} />{/if}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<!-- Site colours, rendered server-side (previously applied in onMount, which
|
||||
<!-- Site colours and style, rendered server-side (previously applied in onMount, which
|
||||
flashed the defaults on every page load). Values are sanitised. -->
|
||||
{@html rootStyleTag(siteThemeVars(data.colors))}
|
||||
{@html rootStyleTag(siteThemeVars(data.colors, data.style))}
|
||||
</svelte:head>
|
||||
|
||||
<Header header={data.header} />
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
Your booking is confirmed. A receipt was sent to <strong>{data.order.email}</strong>.
|
||||
</p>
|
||||
|
||||
<div class="mt-8 rounded-box border border-charcoal/10 bg-white/60 p-6 text-left">
|
||||
<div class="mt-8 rounded-2xl border border-charcoal/10 bg-white/60 p-6 text-left">
|
||||
<h2 class="font-serif text-xl">Your order</h2>
|
||||
<ul class="mt-4 space-y-3">
|
||||
{#each data.order.lines ?? [] as line}
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
{#if data.order.passes?.length}
|
||||
<!-- Bundles bought: their codes (also in the confirmation email). -->
|
||||
<div class="mt-6 rounded-box border border-sage/40 bg-sage/10 p-6 text-left">
|
||||
<div class="mt-6 rounded-2xl border border-sage/40 bg-sage/10 p-6 text-left">
|
||||
<h2 class="font-serif text-xl">Your {data.order.passes.length === 1 ? 'code' : 'codes'}</h2>
|
||||
<p class="mt-1 text-sm text-charcoal/70">Enter a code in the basket when you book — the sessions it includes are then already paid for.</p>
|
||||
{#each data.order.passes as pass (pass.id)}
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
</div>
|
||||
{/if}
|
||||
|
||||
<a class="btn mt-8 rounded-full border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href={links.booking}>Book another</a>
|
||||
<a class="btn mt-8 rounded-button border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href={links.booking}>Book another</a>
|
||||
{:else if data.state === 'processing'}
|
||||
<h1 class="font-serif text-4xl">Processing your payment…</h1>
|
||||
<p class="mt-3 text-charcoal/70">
|
||||
|
|
@ -82,10 +82,10 @@
|
|||
{:else if data.state === 'canceled' || data.state === 'failed'}
|
||||
<h1 class="font-serif text-4xl">Payment not completed</h1>
|
||||
<p class="mt-3 text-charcoal/70">Your payment didn't go through — no money was captured. Please try again.</p>
|
||||
<a class="btn mt-8 rounded-full border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href={links.basket}>Back to your basket</a>
|
||||
<a class="btn mt-8 rounded-button border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href={links.basket}>Back to your basket</a>
|
||||
{:else}
|
||||
<h1 class="font-serif text-4xl">Nothing to see here</h1>
|
||||
<p class="mt-3 text-charcoal/70">This link is missing a payment reference.</p>
|
||||
<a class="btn mt-8 rounded-full border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href={links.booking}>Back to the shop</a>
|
||||
<a class="btn mt-8 rounded-button border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href={links.booking}>Back to the shop</a>
|
||||
{/if}
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue