Compare commits
No commits in common. "312dc5ed3c29e7a16f2b2f9181619026dac7a2f0" and "2c0f54b1f77d085ebc0935b34bbb031ada2acb7f" have entirely different histories.
312dc5ed3c
...
2c0f54b1f7
7 changed files with 14 additions and 144 deletions
|
|
@ -143,7 +143,6 @@ To add an email block type: add to `EmailBlockType` in `packages/shared/src/type
|
||||||
### Styling
|
### Styling
|
||||||
- **Public site**: Custom theme via `@theme` in `app.css` — colors: `warm`, `charcoal`, `sage`, `sage-dark`, `terracotta`. Fonts: `font-sans` (body), `font-serif` (headings), chosen in Site design → Style (default DM Sans / Playfair Display).
|
- **Public site**: Custom theme via `@theme` in `app.css` — colors: `warm`, `charcoal`, `sage`, `sage-dark`, `terracotta`. Fonts: `font-sans` (body), `font-serif` (headings), chosen in Site design → Style (default DM Sans / Playfair Display).
|
||||||
- **Site design → Style** (`style` global: fonts, corners, text size, shadows, page width) becomes `--site-*` variables (`siteStyleVars` in `$shared/theme`) that the `@theme` tokens in both `app.css` files scale. So in public-site markup use the tokens — `rounded-xl`/`rounded-2xl`/`rounded-card`/`rounded-panel`, `shadow-sm`…`shadow-xl`, `max-w-3xl`/`6xl`/`7xl` — never `rounded-[2rem]` or an arbitrary `shadow-[…]`, which ignore the settings. Buttons, chips and icon buttons are `rounded-button` (a pill when Round, square when Sharp); only dots, avatars and badges stay `rounded-full`.
|
- **Site design → Style** (`style` global: fonts, corners, text size, shadows, page width) becomes `--site-*` variables (`siteStyleVars` in `$shared/theme`) that the `@theme` tokens in both `app.css` files scale. So in public-site markup use the tokens — `rounded-xl`/`rounded-2xl`/`rounded-card`/`rounded-panel`, `shadow-sm`…`shadow-xl`, `max-w-3xl`/`6xl`/`7xl` — never `rounded-[2rem]` or an arbitrary `shadow-[…]`, which ignore the settings. Buttons, chips and icon buttons are `rounded-button` (a pill when Round, square when Sharp); only dots, avatars and badges stay `rounded-full`.
|
||||||
- Keep scrolling smooth: no `backdrop-blur` on public pages (it is redrawn on every scrolled frame; use a nearly solid background), and keep animations short. The `.reveal` / `.animate-fade-in` animations are switched off for people who ask for reduced motion and, by `scrollReveal.ts`, on devices that stutter (`plain-motion` on `<html>`, rules in both `app.css` files).
|
|
||||||
- Fonts are bundled `@fontsource-variable/*` packages, imported in each app's `src/lib/fonts.ts` and listed in `SITE_FONTS`; a new one goes in all three places.
|
- Fonts are bundled `@fontsource-variable/*` packages, imported in each app's `src/lib/fonts.ts` and listed in `SITE_FONTS`; a new one goes in all three places.
|
||||||
- **Admin area**: DaisyUI **5** (no `form-control` / `label-text` / `*-bordered` — those are v4). Colours come from Site design via `$shared/theme`, rendered as a `<style>` in `<head>` (SSR, no flash): the admin gets only DaisyUI primary (= site Primary) and secondary (= site Accent) with auto-contrast text; `/preview` and the public site get all site colour variables. Never use `text-primary`/`text-secondary` for text — a light brand colour is unreadable as text; mark state with a tint/bar instead. Conventions:
|
- **Admin area**: DaisyUI **5** (no `form-control` / `label-text` / `*-bordered` — those are v4). Colours come from Site design via `$shared/theme`, rendered as a `<style>` in `<head>` (SSR, no flash): the admin gets only DaisyUI primary (= site Primary) and secondary (= site Accent) with auto-contrast text; `/preview` and the public site get all site colour variables. Never use `text-primary`/`text-secondary` for text — a light brand colour is unreadable as text; mark state with a tint/bar instead. Conventions:
|
||||||
- Section card: `rounded-box bg-base-100 p-5 shadow` with an `h2.text-2xl.font-bold` title (see Site design / globals).
|
- Section card: `rounded-box bg-base-100 p-5 shadow` with an `h2.text-2xl.font-bold` title (see Site design / globals).
|
||||||
|
|
|
||||||
|
|
@ -167,13 +167,12 @@ h4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Scroll-reveal animations ── */
|
/* ── Scroll-reveal animations ── */
|
||||||
/* Kept short: blocks fading in while someone scrolls are what slows scrolling down. */
|
|
||||||
.reveal {
|
.reveal {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(16px);
|
transform: translateY(30px);
|
||||||
transition:
|
transition:
|
||||||
opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
|
opacity 0.7s cubic-bezier(0.25, 0.1, 0.25, 1),
|
||||||
transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
|
transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.reveal-visible {
|
.reveal-visible {
|
||||||
|
|
@ -184,8 +183,8 @@ h4 {
|
||||||
/* ── Hero fade-in stagger ── */
|
/* ── Hero fade-in stagger ── */
|
||||||
.animate-fade-in {
|
.animate-fade-in {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(12px);
|
transform: translateY(20px);
|
||||||
animation: fadeInUp 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
|
animation: fadeInUp 0.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeInUp {
|
@keyframes fadeInUp {
|
||||||
|
|
@ -200,30 +199,6 @@ html {
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No animations on devices that can't keep up (scrollReveal.ts adds .plain-motion
|
|
||||||
to <html>) or for people whose device asks for less motion. */
|
|
||||||
html.plain-motion .reveal,
|
|
||||||
html.plain-motion .animate-fade-in {
|
|
||||||
opacity: 1;
|
|
||||||
transform: none;
|
|
||||||
transition: none;
|
|
||||||
animation: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
|
||||||
.reveal,
|
|
||||||
.animate-fade-in {
|
|
||||||
opacity: 1;
|
|
||||||
transform: none;
|
|
||||||
transition: none;
|
|
||||||
animation: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
scroll-behavior: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Visual editor (RichTextEditor): roughly how the site shows text, sized for the sidebar. */
|
/* Visual editor (RichTextEditor): roughly how the site shows text, sized for the sidebar. */
|
||||||
.rich-text h2 { font-size: 1.5rem; font-weight: 700; margin: 0.75rem 0 0.25rem; }
|
.rich-text h2 { font-size: 1.5rem; font-weight: 700; margin: 0.75rem 0 0.25rem; }
|
||||||
.rich-text h3 { font-size: 1.2rem; font-weight: 700; margin: 0.75rem 0 0.25rem; }
|
.rich-text h3 { font-size: 1.2rem; font-weight: 700; margin: 0.75rem 0 0.25rem; }
|
||||||
|
|
|
||||||
|
|
@ -157,13 +157,12 @@ h4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Scroll-reveal animations ── */
|
/* ── Scroll-reveal animations ── */
|
||||||
/* Kept short: blocks fading in while someone scrolls are what slows scrolling down. */
|
|
||||||
.reveal {
|
.reveal {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(16px);
|
transform: translateY(30px);
|
||||||
transition:
|
transition:
|
||||||
opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
|
opacity 0.7s cubic-bezier(0.25, 0.1, 0.25, 1),
|
||||||
transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
|
transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.reveal-visible {
|
.reveal-visible {
|
||||||
|
|
@ -174,8 +173,8 @@ h4 {
|
||||||
/* ── Hero fade-in stagger ── */
|
/* ── Hero fade-in stagger ── */
|
||||||
.animate-fade-in {
|
.animate-fade-in {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(12px);
|
transform: translateY(20px);
|
||||||
animation: fadeInUp 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
|
animation: fadeInUp 0.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeInUp {
|
@keyframes fadeInUp {
|
||||||
|
|
@ -189,27 +188,3 @@ h4 {
|
||||||
html {
|
html {
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No animations on devices that can't keep up (scrollReveal.ts adds .plain-motion
|
|
||||||
to <html>) or for people whose device asks for less motion. */
|
|
||||||
html.plain-motion .reveal,
|
|
||||||
html.plain-motion .animate-fade-in {
|
|
||||||
opacity: 1;
|
|
||||||
transform: none;
|
|
||||||
transition: none;
|
|
||||||
animation: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
|
||||||
.reveal,
|
|
||||||
.animate-fade-in {
|
|
||||||
opacity: 1;
|
|
||||||
transform: none;
|
|
||||||
transition: none;
|
|
||||||
animation: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
scroll-behavior: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
</svg>
|
</svg>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
<header class="sticky top-0 z-40 border-b border-charcoal/5 bg-warm/95">
|
<header class="sticky top-0 z-40 border-b border-charcoal/5 bg-warm/90 backdrop-blur">
|
||||||
<div class="mx-auto flex max-w-6xl items-center justify-between gap-3 px-4 py-3 sm:px-6 md:gap-4 md:py-4">
|
<div class="mx-auto flex max-w-6xl items-center justify-between gap-3 px-4 py-3 sm:px-6 md:gap-4 md:py-4">
|
||||||
<a class="flex min-w-0 items-center gap-3" href="/" aria-label="Home">
|
<a class="flex min-w-0 items-center gap-3" href="/" aria-label="Home">
|
||||||
{#if header.logo?.url}
|
{#if header.logo?.url}
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,12 @@
|
||||||
{data.heading || 'Holistic and Experiential Learning about Happiness'}
|
{data.heading || 'Holistic and Experiential Learning about Happiness'}
|
||||||
</h1>
|
</h1>
|
||||||
{#if data.subheading}
|
{#if data.subheading}
|
||||||
<p class="animate-fade-in mx-auto mt-6 max-w-2xl text-lg leading-relaxed text-fg-subheading/70 md:text-xl" style="animation-delay: 0.1s;">
|
<p class="animate-fade-in mx-auto mt-6 max-w-2xl text-lg leading-relaxed text-fg-subheading/70 md:text-xl" style="animation-delay: 0.15s;">
|
||||||
{data.subheading}
|
{data.subheading}
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
{#if data.buttonLabel}
|
{#if data.buttonLabel}
|
||||||
<div class="animate-fade-in mt-10" style="animation-delay: 0.2s;">
|
<div class="animate-fade-in mt-10" style="animation-delay: 0.3s;">
|
||||||
<a class="btn rounded-button border-0 bg-sage px-10 py-3 text-lg text-primary-content shadow-lg transition hover:bg-sage-dark hover:shadow-xl" href={data.buttonUrl || shopLinks(page.data.header).booking}>
|
<a class="btn rounded-button border-0 bg-sage px-10 py-3 text-lg text-primary-content shadow-lg transition hover:bg-sage-dark hover:shadow-xl" href={data.buttonUrl || shopLinks(page.data.header).booking}>
|
||||||
{data.buttonLabel}
|
{data.buttonLabel}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
{:else}
|
{:else}
|
||||||
<div class="isolate grid gap-8 lg:grid-cols-2">
|
<div class="isolate grid gap-8 lg:grid-cols-2">
|
||||||
{#each months as month}
|
{#each months as month}
|
||||||
<div class="relative z-0 overflow-visible rounded-panel border border-sage/15 bg-white/90 p-3 shadow-sm sm:p-5 hover:z-[9000] focus-within:z-[9000]">
|
<div class="relative z-0 overflow-visible rounded-panel border border-sage/15 bg-white/80 p-3 shadow-sm sm:p-5 backdrop-blur hover:z-[9000] focus-within:z-[9000]">
|
||||||
<h3 class="font-display mb-5 text-center text-3xl text-charcoal">{month.label}</h3>
|
<h3 class="font-display mb-5 text-center text-3xl text-charcoal">{month.label}</h3>
|
||||||
<div class="mb-2 grid grid-cols-7 gap-1 text-center text-xs font-semibold uppercase tracking-wide text-charcoal/45">
|
<div class="mb-2 grid grid-cols-7 gap-1 text-center text-xs font-semibold uppercase tracking-wide text-charcoal/45">
|
||||||
{#each weekdays as weekday}<div>{weekday}</div>{/each}
|
{#each weekdays as weekday}<div>{weekday}</div>{/each}
|
||||||
|
|
|
||||||
|
|
@ -2,88 +2,9 @@
|
||||||
* Scroll reveal Svelte action — applies a CSS class when the element enters the viewport.
|
* Scroll reveal Svelte action — applies a CSS class when the element enters the viewport.
|
||||||
* Usage: <div use:scrollReveal class="reveal">...</div>
|
* Usage: <div use:scrollReveal class="reveal">...</div>
|
||||||
* The `reveal` class is hidden initially; `reveal-visible` is added on intersection.
|
* The `reveal` class is hidden initially; `reveal-visible` is added on intersection.
|
||||||
*
|
|
||||||
* On a device that can't keep up, the animations are switched off for the rest
|
|
||||||
* of the visit (`plain-motion` on <html>, see app.css): one with very few cores
|
|
||||||
* or little memory straight away, any other once scrolling is seen to stutter.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const PLAIN = 'plain-motion';
|
|
||||||
const STORAGE_KEY = 'plain-motion';
|
|
||||||
/** Scrolled frames to look at before deciding, and how many may run late. */
|
|
||||||
const SAMPLE_FRAMES = 120;
|
|
||||||
const LATE_SHARE = 0.1;
|
|
||||||
/** A frame this long missed at least one refresh of a 60 Hz screen. */
|
|
||||||
const LATE_MS = 25;
|
|
||||||
|
|
||||||
let watching = false;
|
|
||||||
|
|
||||||
function usePlainMotion() {
|
|
||||||
document.documentElement.classList.add(PLAIN);
|
|
||||||
try {
|
|
||||||
sessionStorage.setItem(STORAGE_KEY, '1');
|
|
||||||
} catch {
|
|
||||||
// Storage blocked: decided again on the next page.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function weakHardware() {
|
|
||||||
const memory = (navigator as Navigator & { deviceMemory?: number }).deviceMemory;
|
|
||||||
return (navigator.hardwareConcurrency || 8) <= 2 || (memory !== undefined && memory <= 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Times frames while the page scrolls; too many late ones switch the animations off. */
|
|
||||||
function watchScrolling() {
|
|
||||||
if (watching || typeof window === 'undefined') return;
|
|
||||||
watching = true;
|
|
||||||
|
|
||||||
let stored = false;
|
|
||||||
try {
|
|
||||||
stored = sessionStorage.getItem(STORAGE_KEY) === '1';
|
|
||||||
} catch {
|
|
||||||
// Storage blocked: measure instead.
|
|
||||||
}
|
|
||||||
if (stored || weakHardware()) {
|
|
||||||
usePlainMotion();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let frames = 0;
|
|
||||||
let late = 0;
|
|
||||||
let last = 0;
|
|
||||||
let lastScroll = 0;
|
|
||||||
let running = false;
|
|
||||||
|
|
||||||
function tick(now: number) {
|
|
||||||
if (last) {
|
|
||||||
frames++;
|
|
||||||
if (now - last > LATE_MS) late++;
|
|
||||||
}
|
|
||||||
last = now;
|
|
||||||
if (frames >= SAMPLE_FRAMES) {
|
|
||||||
window.removeEventListener('scroll', onScroll);
|
|
||||||
if (late / frames > LATE_SHARE) usePlainMotion();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Only frames while scrolling count; stop shortly after it ends.
|
|
||||||
if (now - lastScroll < 300) requestAnimationFrame(tick);
|
|
||||||
else running = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onScroll() {
|
|
||||||
lastScroll = performance.now();
|
|
||||||
if (running) return;
|
|
||||||
running = true;
|
|
||||||
last = 0;
|
|
||||||
requestAnimationFrame(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('scroll', onScroll, { passive: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
export function scrollReveal(node: HTMLElement, delay: number = 0) {
|
export function scrollReveal(node: HTMLElement, delay: number = 0) {
|
||||||
watchScrolling();
|
|
||||||
|
|
||||||
const observer = new IntersectionObserver(
|
const observer = new IntersectionObserver(
|
||||||
(entries) => {
|
(entries) => {
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue