Added background and foreground settings to blocks, and scroll in animations

This commit is contained in:
Jakub Dorfman 2026-05-18 18:39:49 +02:00
parent b4fbf3e411
commit 94c1e0b679
24 changed files with 826 additions and 44 deletions

105
AGENTS.md Normal file
View file

@ -0,0 +1,105 @@
# Massage Studio Website CMS — Agent Guidelines
## Stack
- **SvelteKit 2** (SSR, Svelte 5 runes mode) — all `.svelte` files use `$state`, `$derived`, `$props()` etc.
- **PocketBase** — REST API via the `pocketbase` SDK (v0.26). Auth, DB, and image storage.
- **Tailwind CSS v4** + **DaisyUI 5** — utility-first CSS with DaisyUI components for admin; custom theme for the public site.
- **Docker Compose** — two services: `app` (SvelteKit) and `pocketbase`.
## Project Structure
```
app/ # SvelteKit application
├── src/
│ ├── lib/
│ │ ├── admin/ # Admin UI components (BlockList, editors)
│ │ ├── blocks/ # Public block renderers (one per BlockType)
│ │ ├── components/ # Header.svelte, Footer.svelte
│ │ ├── pb.ts # PocketBase client factory + helpers
│ │ └── types.ts # ContentBlock, PageRecord, HeaderGlobal, FooterGlobal
│ ├── routes/
│ │ ├── +layout.svelte # Root layout (admin vs public shell)
│ │ ├── +page.svelte # Home page (slug=home)
│ │ ├── [slug]/ # Dynamic CMS pages
│ │ ├── admin/ # Admin area (login, pages, globals)
│ │ └── preview/ # Draft preview via sessionStorage
│ └── app.css # Tailwind + DaisyUI + custom theme
├── static/ # Static assets
├── build/ # Production build output
├── svelte.config.js # Adapter-node, runes mode forced
├── vite.config.ts # Tailwind v4 + SvelteKit plugins
└── package.json
pocketbase/pb_data/ # PocketBase data (mounted volume-mounted)
docker-compose.yml # app + pocketbase services
Dockerfile # Multi-stage Node 22 build
```
## Key Conventions
### Svelte 5 Runes Mode
All components use Svelte 5 runes syntax — **never** `export let`, `$:`, or `on:click`. Use:
- `$props()` for component props
- `$state()` for reactive local state
- `$derived()` for computed values
- `$effect()` / `onMount` for side effects
- `{@render children()}` for slots
- `onclick={handler}` (not `on:click`)
### Block System
Pages are composed of `ContentBlock[]`. Each block has `{ id, type, data }`. Block types are defined in `$lib/types.ts`:
`text | image | image_text | timeline | testimonials | services | cta | spacer | horizontal_cards`
- **Public renderers**: `$lib/blocks/<Type>Block.svelte` — one per type, receives `data` prop
- **Admin editors**: `$lib/admin/editors/BlockEditor.svelte` — switches editor UI by type
- **Defaults**: `$lib/admin/blockDefaults.ts` — `createBlock(type)` generates a new block with sensible defaults
- **Block list**: `$lib/admin/BlockList.svelte` — draggable reorder, select, delete
To add a new block type: add to `BlockType` union in `types.ts`, create renderer in `$lib/blocks/`, add editor case in `BlockEditor.svelte`, add default in `blockDefaults.ts`, add import in `BlockRenderer.svelte`.
### PocketBase Integration
- Client created in `hooks.server.ts` (`event.locals.pb`) — injected per-request with auth cookie
- `$lib/pb.ts` exports `createPocketBase()`, `getFileUrl()`, `uploadMedia()`
- Collections: `pages` (slug, title, blocks[], published), `globals` (key, data), `media` (file, alt)
- Server load functions use `locals.pb.collection('pages').getFirstListItem()`
### Styling
- **Public site**: Custom theme via `@theme` in `app.css` — colors: `warm`, `charcoal`, `sage`, `sage-dark`, `terracotta`. Fonts: `DM Sans` (body), `Playfair Display` (headings).
- **Admin area**: DaisyUI utility classes (`btn`, `card`, `input`, `select`, `rounded-box`, etc.)
- **Prose**: `.prose-wellness` class for rich text content styling
### Routing
- `+layout.server.ts` fetches header/footer globals for every public page
- `+page.server.ts` for home fetches `slug = "home" && published = true`
- `[slug]/+page.server.ts` fetches by dynamic slug
- Admin routes protected in `hooks.server.ts` — redirects to `/admin/login` if unauthenticated
## Build & Dev Commands
```sh
# Development (from app/)
cd app
npm install
npm run dev # http://localhost:5173
# Production build
npm run build
# Type checking
npm run check
# Docker full stack
docker compose up --build
# App: http://localhost:3000
# PocketBase admin: http://localhost:8090/_/
# PocketBase only (for local dev)
docker compose up pocketbase
```
## Environment
- `PUBLIC_POCKETBASE_URL` — public-facing PocketBase URL (default `http://localhost:8090`)
- `POCKETBASE_INTERNAL_URL` — internal Docker network URL (`http://pocketbase:80`)
- `ORIGIN` — SvelteKit origin for SSR (`http://localhost:3000`)
- Copy `app/.env.example` → `app/.env` for local dev

View file

@ -15,11 +15,22 @@
}
:root {
--fg-heading: #2c2c2c;
--fg-body: #2c2c2c;
background: #faf8f5;
color: #2c2c2c;
color: var(--fg-body);
font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
}
/* ── Foreground colour utilities (set per-block via BackgroundWrapper) ── */
.text-fg-body { color: var(--fg-body, #2c2c2c); }
.text-fg-body\/85 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 85%, transparent); }
.text-fg-body\/80 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 80%, transparent); }
.text-fg-body\/75 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 75%, transparent); }
.text-fg-body\/70 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 70%, transparent); }
.text-fg-body\/60 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 60%, transparent); }
.text-fg-heading { color: var(--fg-heading, #2c2c2c); }
body {
min-height: 100vh;
margin: 0;
@ -33,7 +44,7 @@ h2,
h3,
h4 {
font-family: 'Playfair Display', Georgia, serif;
color: #2c2c2c;
color: var(--fg-heading, #2c2c2c);
}
.prose-wellness p {
@ -62,3 +73,36 @@ h4 {
text-decoration: underline;
text-underline-offset: 3px;
}
/* ── Scroll-reveal animations ── */
.reveal {
opacity: 0;
transform: translateY(30px);
transition:
opacity 0.7s cubic-bezier(0.25, 0.1, 0.25, 1),
transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.reveal-visible {
opacity: 1;
transform: translateY(0);
}
/* ── Hero fade-in stagger ── */
.animate-fade-in {
opacity: 0;
transform: translateY(20px);
animation: fadeInUp 0.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}
@keyframes fadeInUp {
to {
opacity: 1;
transform: translateY(0);
}
}
/* ── Smooth scroll ── */
html {
scroll-behavior: smooth;
}

View file

@ -10,7 +10,14 @@ export const blockLabels: Record<BlockType, string> = {
services: 'Services',
cta: 'Call to Action',
spacer: 'Spacer',
horizontal_cards: 'Horizontal Cards'
horizontal_cards: 'Horizontal Cards',
hero: 'Hero',
columns: 'Columns',
pricing_table: 'Pricing Table',
newsletter: 'Newsletter',
articles_list: 'Articles List',
profile_card: 'Profile Card',
features_list: 'Features List'
};
export const blockTypes = Object.keys(blockLabels) as BlockType[];
@ -45,6 +52,86 @@ export function createBlock(type: BlockType): ContentBlock {
case 'horizontal_cards':
base.data = { items: [{ title: 'Card title', description: 'Card description', url: '', link: '' }] };
break;
case 'hero':
base.data = {
heading: 'Holistic and Experiential Learning about Happiness',
subheading: 'Individual sessions, workshops and events in Oslo',
buttonLabel: 'BOOK NOW',
buttonUrl: '/book',
backgroundImage: ''
};
break;
case 'columns':
base.data = {
heading: 'Elements of Holistic Sexology',
items: [
{ title: 'Coaching and Mind Work', content: '<p>Explore beliefs, thoughts and emotions associated with your sexuality.</p>', icon: '🧠' },
{ title: 'Somatic Practices', content: '<p>Use sound, breathing, movement, touch to increase sensitivity.</p>', icon: '🧘' },
{ title: 'Harmonizing the Energy System', content: '<p>Techniques of Shiatsu based on Chinese medicine to resolve blockages.</p>', icon: '⚡' }
]
};
break;
case 'pricing_table':
base.data = {
heading: 'Prices',
items: [
{ duration: '60 min', price: '2000 NOK' },
{ duration: '90 min', price: '2500 NOK' },
{ duration: '120 min', price: '3000 NOK' },
{ duration: '150 min', price: '3500 NOK' },
{ duration: '180 min', price: '4000 NOK' }
]
};
break;
case 'newsletter':
base.data = {
heading: 'Want to stay connected?',
subtext: 'Sign up to receive my free videos and articles that allow you to know more about the secrets of sexual bliss.',
buttonLabel: 'Yes, please!',
placeholder: 'Your email address'
};
break;
case 'articles_list':
base.data = {
heading: 'My Favourite Articles',
items: [
{ title: 'As a "real" man you need to be hard! Sexual performance anxiety in men', url: '/article1' },
{ title: 'Listen to your body! What numbness is communicating to you?', url: '/article2' },
{ title: 'Reclaim your pleasure and joy! Consent and clear empowered communication are the basis', url: '/article3' }
]
};
break;
case 'profile_card':
base.data = {
name: 'Alegría',
tagline: 'Holistic Sensual Massage Therapist',
image: '',
description: '<p>Let yourself be pampered like Caesar by Cleopatra.</p>',
education: ['Professional training in holistic sensual massage Core Touch I and II'],
contact: '+47 40158395',
profileUrl: ''
};
break;
case 'features_list':
base.data = {
heading: 'In my sessions, I teach...',
categories: [
{
title: 'For men',
items: ['Overcome sexual anxiety', 'Last as long as you want', 'Treat erectile dysfunction without drugs']
},
{
title: 'For women',
items: ['Increase sensitivity in the whole body', 'Unlock every possible kind of orgasm', 'Release fear, shame and trauma']
},
{
title: 'For couples',
items: ['Feel more connected while lovemaking', 'Master the art of Tantric sex', 'Deepen your relationship']
}
]
};
break;
}
base.data._background = { type: 'none', color: '', imageUrl: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 };
return base;
}

View file

@ -94,6 +94,164 @@
</div>
{/each}
<button class="btn" type="button" onclick={() => addArrayItem('items', { title: '', description: '', url: '', link: '' })}>Add card</button>
{:else if block.type === 'hero'}
{#each ['heading', 'subheading', 'buttonLabel', 'buttonUrl', 'backgroundImage'] as field}
<label class="form-control"><span class="label-text capitalize">{field.replace(/([A-Z])/g, ' $1')}</span><input class="input input-bordered" value={block.data[field] || ''} oninput={(e) => updateData({ [field]: e.currentTarget.value })} /></label>
{/each}
{:else if block.type === 'columns'}
{#each ['heading'] as field}
<label class="form-control"><span class="label-text capitalize">{field}</span><input class="input input-bordered" value={block.data[field] || ''} oninput={(e) => updateData({ [field]: e.currentTarget.value })} /></label>
{/each}
<h3 class="mt-4 font-bold">Columns</h3>
{#each block.data.items || [] as item, i}
<div class="rounded-box mb-3 border border-base-300 p-3">
<input class="input input-bordered mb-2 w-full" placeholder="Title" value={item.title} oninput={(e) => updateArray('items', i, { title: e.currentTarget.value })} />
<input class="input input-bordered mb-2 w-full" placeholder="Icon (emoji)" value={item.icon || ''} oninput={(e) => updateArray('items', i, { icon: e.currentTarget.value })} />
<textarea class="textarea textarea-bordered w-full" placeholder="HTML Content" value={item.content} oninput={(e) => updateArray('items', i, { content: e.currentTarget.value })}></textarea>
<button class="btn btn-error btn-sm mt-2" type="button" onclick={() => removeArrayItem('items', i)}>Remove</button>
</div>
{/each}
<button class="btn" type="button" onclick={() => addArrayItem('items', { title: '', icon: '', content: '' })}>Add column</button>
{:else if block.type === 'pricing_table'}
{#each ['heading'] as field}
<label class="form-control"><span class="label-text capitalize">{field}</span><input class="input input-bordered" value={block.data[field] || ''} oninput={(e) => updateData({ [field]: e.currentTarget.value })} /></label>
{/each}
<h3 class="mt-4 font-bold">Price rows</h3>
{#each block.data.items || [] as item, i}
<div class="rounded-box mb-3 border border-base-300 p-3">
<input class="input input-bordered mb-2 w-full" placeholder="Duration" value={item.duration} oninput={(e) => updateArray('items', i, { duration: e.currentTarget.value })} />
<input class="input input-bordered w-full" placeholder="Price" value={item.price} oninput={(e) => updateArray('items', i, { price: e.currentTarget.value })} />
<button class="btn btn-error btn-sm mt-2" type="button" onclick={() => removeArrayItem('items', i)}>Remove</button>
</div>
{/each}
<button class="btn" type="button" onclick={() => addArrayItem('items', { duration: '', price: '' })}>Add row</button>
{:else if block.type === 'newsletter'}
{#each ['heading', 'subtext', 'buttonLabel', 'placeholder'] as field}
<label class="form-control"><span class="label-text capitalize">{field}</span><input class="input input-bordered" value={block.data[field] || ''} oninput={(e) => updateData({ [field]: e.currentTarget.value })} /></label>
{/each}
{:else if block.type === 'articles_list'}
{#each ['heading'] as field}
<label class="form-control"><span class="label-text capitalize">{field}</span><input class="input input-bordered" value={block.data[field] || ''} oninput={(e) => updateData({ [field]: e.currentTarget.value })} /></label>
{/each}
<h3 class="mt-4 font-bold">Articles</h3>
{#each block.data.items || [] as item, i}
<div class="rounded-box mb-3 border border-base-300 p-3">
<input class="input input-bordered mb-2 w-full" placeholder="Title" value={item.title} oninput={(e) => updateArray('items', i, { title: e.currentTarget.value })} />
<input class="input input-bordered w-full" placeholder="URL" value={item.url} oninput={(e) => updateArray('items', i, { url: e.currentTarget.value })} />
<button class="btn btn-error btn-sm mt-2" type="button" onclick={() => removeArrayItem('items', i)}>Remove</button>
</div>
{/each}
<button class="btn" type="button" onclick={() => addArrayItem('items', { title: '', url: '' })}>Add article</button>
{:else if block.type === 'profile_card'}
{#each ['name', 'tagline', 'image', 'contact', 'profileUrl'] as field}
<label class="form-control"><span class="label-text capitalize">{field.replace(/([A-Z])/g, ' $1')}</span><input class="input input-bordered" value={block.data[field] || ''} oninput={(e) => updateData({ [field]: e.currentTarget.value })} /></label>
{/each}
<label class="form-control"><span class="label-text">Description (HTML)</span><textarea class="textarea textarea-bordered w-full" value={block.data.description || ''} oninput={(e) => updateData({ description: e.currentTarget.value })}></textarea></label>
<h3 class="mt-4 font-bold">Education</h3>
{#each block.data.education || [] as edu, i}
<div class="flex gap-2 mb-2">
<input class="input input-bordered flex-1" value={edu} oninput={(e) => {
const arr = [...(block.data.education || [])];
arr[i] = e.currentTarget.value;
updateData({ education: arr });
}} />
<button class="btn btn-error btn-sm" type="button" onclick={() => {
const arr = (block.data.education || []).filter((_: unknown, idx: number) => idx !== i);
updateData({ education: arr });
}}>×</button>
</div>
{/each}
<button class="btn btn-sm" type="button" onclick={() => updateData({ education: [...(block.data.education || []), ''] })}>Add education</button>
{:else if block.type === 'features_list'}
{#each ['heading'] as field}
<label class="form-control"><span class="label-text capitalize">{field}</span><input class="input input-bordered" value={block.data[field] || ''} oninput={(e) => updateData({ [field]: e.currentTarget.value })} /></label>
{/each}
<h3 class="mt-4 font-bold">Categories</h3>
{#each block.data.categories || [] as cat, ci}
<div class="rounded-box mb-3 border border-base-300 p-3">
<input class="input input-bordered mb-2 w-full" placeholder="Category title" value={cat.title} oninput={(e) => updateArray('categories', ci, { title: e.currentTarget.value })} />
<p class="text-xs text-base-content/60 mb-1">Items (one per line)</p>
<textarea class="textarea textarea-bordered w-full" rows="4" value={(cat.items || []).join('\n')} oninput={(e) => updateArray('categories', ci, { items: e.currentTarget.value.split('\n').filter((s) => s.trim()) })}></textarea>
<button class="btn btn-error btn-sm" type="button" onclick={() => removeArrayItem('categories', ci)}>Remove</button>
</div>
{/each}
<button class="btn" type="button" onclick={() => addArrayItem('categories', { title: '', items: [] })}>Add category</button>
{/if}
<hr class="my-6" />
<details class="rounded-box border border-base-300 p-3">
<summary class="cursor-pointer font-semibold text-base-content/70">Background settings</summary>
<div class="mt-4 space-y-3">
<label class="form-control">
<span class="label-text">Background type</span>
<select class="select select-bordered" value={block.data._background?.type || 'none'} onchange={(e) => updateData({ _background: { ...(block.data._background || {}), type: e.currentTarget.value } })}>
<option value="none">None</option>
<option value="color">Solid color</option>
<option value="image">Image</option>
</select>
</label>
{#if (block.data._background?.type) === 'color'}
<label class="form-control">
<span class="label-text">Color</span>
<input class="input input-bordered" type="color" value={block.data._background?.color || '#66755d'} oninput={(e) => updateData({ _background: { ...(block.data._background || {}), color: e.currentTarget.value } })} />
</label>
<label class="form-control">
<span class="label-text">Or type a CSS color</span>
<input class="input input-bordered" placeholder="#66755d or rgba(…) or sage" value={block.data._background?.color || ''} oninput={(e) => updateData({ _background: { ...(block.data._background || {}), color: e.currentTarget.value } })} />
</label>
{/if}
{#if (block.data._background?.type) === 'image'}
<label class="form-control">
<span class="label-text">Image URL</span>
<input class="input input-bordered" placeholder="https://…" value={block.data._background?.imageUrl || ''} oninput={(e) => updateData({ _background: { ...(block.data._background || {}), imageUrl: e.currentTarget.value } })} />
</label>
<label class="form-control">
<span class="label-text">Attachment</span>
<select class="select select-bordered" value={block.data._background?.attachment || 'scroll'} onchange={(e) => updateData({ _background: { ...(block.data._background || {}), attachment: e.currentTarget.value } })}>
<option value="scroll">Scroll with page</option>
<option value="fixed">Fixed (parallax)</option>
</select>
</label>
<label class="form-control">
<span class="label-text">Dark overlay</span>
<select class="select select-bordered" value={block.data._background?.overlay ? 'yes' : 'no'} onchange={(e) => updateData({ _background: { ...(block.data._background || {}), overlay: e.currentTarget.value === 'yes' } })}>
<option value="no">No</option>
<option value="yes">Yes</option>
</select>
</label>
{#if block.data._background?.overlay}
<label class="form-control">
<span class="label-text">Overlay opacity ({block.data._background?.overlayOpacity ?? 40}%)</span>
<input class="range range-sm" type="range" min="0" max="100" value={block.data._background?.overlayOpacity ?? 40} oninput={(e) => updateData({ _background: { ...(block.data._background || {}), overlayOpacity: Number(e.currentTarget.value) } })} />
</label>
{/if}
{/if}
</div>
</details>
<details class="mt-3 rounded-box border border-base-300 p-3">
<summary class="cursor-pointer font-semibold text-base-content/70">Foreground settings</summary>
<div class="mt-4 space-y-3">
<label class="form-control">
<span class="label-text">Heading color</span>
<input class="input input-bordered w-full" type="color" value={block.data._foreground?.headingColor || '#2c2c2c'} oninput={(e) => updateData({ _foreground: { ...(block.data._foreground || {}), headingColor: e.currentTarget.value } })} />
</label>
<label class="form-control">
<span class="label-text">Or type a CSS color</span>
<input class="input input-bordered" placeholder="#2c2c2c or rgba(…) or charcoal" value={block.data._foreground?.headingColor || ''} oninput={(e) => updateData({ _foreground: { ...(block.data._foreground || {}), headingColor: e.currentTarget.value } })} />
</label>
<label class="form-control">
<span class="label-text">Body text color</span>
<input class="input input-bordered w-full" type="color" value={block.data._foreground?.bodyColor || '#2c2c2c'} oninput={(e) => updateData({ _foreground: { ...(block.data._foreground || {}), bodyColor: e.currentTarget.value } })} />
</label>
<label class="form-control">
<span class="label-text">Or type a CSS color</span>
<input class="input input-bordered" placeholder="#2c2c2c or rgba(…) or charcoal" value={block.data._foreground?.bodyColor || ''} oninput={(e) => updateData({ _foreground: { ...(block.data._foreground || {}), bodyColor: e.currentTarget.value } })} />
</label>
</div>
</details>
</div>
{/if}

View file

@ -13,6 +13,16 @@
}
});
// Sync content from props when a different block is selected,
// without overwriting content while the user is actively editing.
$effect(() => {
if (mounted && editorEl && value !== undefined) {
if (editorEl.innerHTML !== value) {
editorEl.innerHTML = value || '';
}
}
});
function exec(cmd: string, val?: string) {
if (!browser) return;
editorEl?.focus();

View file

@ -0,0 +1,25 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
type Article = { title: string; url: string };
let { data } = $props<{
data: { heading?: string; items?: Article[] };
}>();
let items = $derived(data.items?.length ? data.items : []);
</script>
<section class="mx-auto max-w-4xl px-6 py-16 md:py-20">
{#if data.heading}
<h2 use:scrollReveal class="reveal mb-10 text-center text-4xl md:text-5xl">{data.heading}</h2>
{/if}
<div use:scrollReveal class="reveal space-y-4">
{#each items as item}
<a class="group block rounded-[1.5rem] bg-white/70 p-6 shadow-sm ring-1 ring-charcoal/5 transition hover:-translate-y-0.5 hover:shadow-md" href={item.url} target="_blank" rel="noreferrer">
<div class="flex items-center justify-between gap-4">
<span class="text-lg leading-relaxed text-fg-body/80 transition group-hover:text-sage-dark">{item.title}</span>
<span class="shrink-0 text-xl text-sage/50 transition group-hover:text-sage-dark">→</span>
</div>
</a>
{/each}
</div>
</section>

View file

@ -0,0 +1,51 @@
<script lang="ts">
import type { BlockBackground, BlockForeground } from '$lib/types';
let {
background = { type: 'none', color: '', imageUrl: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 } satisfies BlockBackground,
foreground = {} as BlockForeground,
children
} = $props<{
background?: BlockBackground;
foreground?: BlockForeground;
children?: import('svelte').Snippet;
}>();
function bgStyle() {
const parts: string[] = [];
if (background.type === 'color' && background.color) {
parts.push(`background-color: ${background.color};`);
}
if (background.type === 'image' && background.imageUrl) {
parts.push(`background-image: url(${background.imageUrl});`);
parts.push(`background-size: cover;`);
parts.push(`background-position: center;`);
parts.push(`background-repeat: no-repeat;`);
parts.push(`background-attachment: ${background.attachment};`);
}
return parts.join(' ');
}
function fgStyle() {
const parts: string[] = [];
if (foreground.headingColor) {
parts.push(`--fg-heading: ${foreground.headingColor};`);
}
if (foreground.bodyColor) {
parts.push(`--fg-body: ${foreground.bodyColor};`);
}
return parts.join(' ');
}
</script>
<div style={bgStyle() + ' ' + fgStyle()} class="relative">
{#if background.type === 'image' && background.overlay && background.imageUrl}
<div
class="pointer-events-none absolute inset-0"
style={`background-color: rgba(0,0,0,${background.overlayOpacity / 100});`}
></div>
{/if}
<div class="relative z-10">
{@render children()}
</div>
</div>

View file

@ -1,5 +1,6 @@
<script lang="ts">
import type { ContentBlock } from '$lib/types';
import type { ContentBlock, BlockBackground, BlockForeground } from '$lib/types';
import BackgroundWrapper from './BackgroundWrapper.svelte';
import TextBlock from './TextBlock.svelte';
import ImageBlock from './ImageBlock.svelte';
import ImageTextBlock from './ImageTextBlock.svelte';
@ -9,28 +10,59 @@
import CtaBlock from './CtaBlock.svelte';
import SpacerBlock from './SpacerBlock.svelte';
import HorizontalCardsBlock from './HorizontalCardsBlock.svelte';
import HeroBlock from './HeroBlock.svelte';
import ColumnsBlock from './ColumnsBlock.svelte';
import PricingTableBlock from './PricingTableBlock.svelte';
import NewsletterBlock from './NewsletterBlock.svelte';
import ArticlesListBlock from './ArticlesListBlock.svelte';
import ProfileCardBlock from './ProfileCardBlock.svelte';
import FeaturesListBlock from './FeaturesListBlock.svelte';
let { blocks = [] } = $props<{ blocks: ContentBlock[] }>();
function getBg(block: ContentBlock): BlockBackground {
return (block.data._background as BlockBackground) || { type: 'none', color: '', imageUrl: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 };
}
function getFg(block: ContentBlock): BlockForeground {
return (block.data._foreground as BlockForeground) || {};
}
</script>
{#each blocks as block (block.id)}
{#if block.type === 'text'}
<TextBlock data={block.data} />
{:else if block.type === 'image'}
<ImageBlock data={block.data} />
{:else if block.type === 'image_text'}
<ImageTextBlock data={block.data} />
{:else if block.type === 'timeline'}
<TimelineBlock data={block.data} />
{:else if block.type === 'testimonials'}
<TestimonialsBlock data={block.data} />
{:else if block.type === 'services'}
<ServicesBlock data={block.data} />
{:else if block.type === 'cta'}
<CtaBlock data={block.data} />
{:else if block.type === 'spacer'}
<SpacerBlock data={block.data} />
{:else if block.type === 'horizontal_cards'}
<HorizontalCardsBlock data={block.data} />
{/if}
<BackgroundWrapper background={getBg(block)} foreground={getFg(block)}>
{#if block.type === 'text'}
<TextBlock data={block.data} />
{:else if block.type === 'image'}
<ImageBlock data={block.data} />
{:else if block.type === 'image_text'}
<ImageTextBlock data={block.data} />
{:else if block.type === 'timeline'}
<TimelineBlock data={block.data} />
{:else if block.type === 'testimonials'}
<TestimonialsBlock data={block.data} />
{:else if block.type === 'services'}
<ServicesBlock data={block.data} />
{:else if block.type === 'cta'}
<CtaBlock data={block.data} />
{:else if block.type === 'spacer'}
<SpacerBlock data={block.data} />
{:else if block.type === 'horizontal_cards'}
<HorizontalCardsBlock data={block.data} />
{:else if block.type === 'hero'}
<HeroBlock data={block.data} />
{:else if block.type === 'columns'}
<ColumnsBlock data={block.data} />
{:else if block.type === 'pricing_table'}
<PricingTableBlock data={block.data} />
{:else if block.type === 'newsletter'}
<NewsletterBlock data={block.data} />
{:else if block.type === 'articles_list'}
<ArticlesListBlock data={block.data} />
{:else if block.type === 'profile_card'}
<ProfileCardBlock data={block.data} />
{:else if block.type === 'features_list'}
<FeaturesListBlock data={block.data} />
{/if}
</BackgroundWrapper>
{/each}

View file

@ -0,0 +1,26 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
type Column = { title: string; content: string; icon?: string };
let { data } = $props<{
data: { heading?: string; items?: Column[] };
}>();
let items = $derived(data.items?.length ? data.items : []);
</script>
<section class="mx-auto max-w-6xl px-6 py-16 md:py-20">
{#if data.heading}
<h2 use:scrollReveal class="reveal mb-14 text-center text-4xl md:text-5xl">{data.heading}</h2>
{/if}
<div class="grid gap-8 md:grid-cols-3">
{#each items as item, i}
<article use:scrollReveal={i * 0.1} class="reveal rounded-[2rem] bg-white/70 p-8 shadow-sm ring-1 ring-charcoal/5">
{#if item.icon}
<span class="mb-4 block text-4xl">{item.icon}</span>
{/if}
<h3 class="mb-4 text-2xl">{item.title}</h3>
<div class="prose-wellness text-fg-body/70">{@html item.content}</div>
</article>
{/each}
</div>
</section>

View file

@ -1,10 +1,12 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
let { data } = $props<{
data: { heading?: string; subtext?: string; buttonLabel?: string; buttonUrl?: string };
}>();
</script>
<section class="px-6 py-16 md:py-20">
<section use:scrollReveal class="reveal px-6 py-16 md:py-20">
<div class="mx-auto max-w-5xl rounded-[2.5rem] bg-sage px-8 py-14 text-center text-white shadow-lg md:px-16">
<h2 class="text-4xl text-white md:text-5xl">{data.heading || 'Ready to feel restored?'}</h2>
<p class="mx-auto mt-5 max-w-2xl text-lg leading-8 text-white/85">{data.subtext || 'Book a massage session designed around your body, pace, and needs.'}</p>

View file

@ -0,0 +1,30 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
type Category = { title: string; items: string[] };
let { data } = $props<{
data: { heading?: string; categories?: Category[] };
}>();
let categories = $derived(data.categories?.length ? data.categories : []);
</script>
<section class="mx-auto max-w-6xl px-6 py-16 md:py-20">
{#if data.heading}
<h2 use:scrollReveal class="reveal mb-12 text-center text-4xl md:text-5xl">{data.heading}</h2>
{/if}
<div class="grid gap-8 md:grid-cols-3">
{#each categories as cat, i}
<article use:scrollReveal={i * 0.1} class="reveal rounded-[2rem] bg-white/70 p-8 shadow-sm ring-1 ring-charcoal/5">
<h3 class="mb-6 text-center text-2xl">{cat.title}</h3>
<ul class="space-y-4">
{#each cat.items as item}
<li class="flex items-start gap-3 text-fg-body/75">
<span class="mt-1 grid h-6 w-6 shrink-0 place-items-center rounded-full bg-sage/15 text-sm text-sage-dark">✓</span>
<span class="leading-relaxed">{item}</span>
</li>
{/each}
</ul>
</article>
{/each}
</div>
</section>

View file

@ -0,0 +1,35 @@
<script lang="ts">
let { data } = $props<{
data: {
heading?: string;
subheading?: string;
buttonLabel?: string;
buttonUrl?: string;
backgroundImage?: string;
};
}>();
</script>
<section class="relative flex min-h-[80vh] items-center justify-center overflow-hidden px-6 py-20 md:min-h-[90vh]">
{#if data.backgroundImage}
<img class="absolute inset-0 h-full w-full object-cover" src={data.backgroundImage} alt="" />
<div class="absolute inset-0 bg-charcoal/50"></div>
{/if}
<div class="relative z-10 mx-auto max-w-4xl text-center">
<h1 class="animate-fade-in text-5xl leading-tight md:text-7xl lg:text-8xl" style="font-family: 'Playfair Display', Georgia, serif;">
{data.heading || 'Holistic and Experiential Learning about Happiness'}
</h1>
{#if data.subheading}
<p class="animate-fade-in mx-auto mt-6 max-w-2xl text-lg leading-relaxed text-fg-body/70 md:text-xl" style="animation-delay: 0.15s;">
{data.subheading}
</p>
{/if}
{#if data.buttonLabel}
<div class="animate-fade-in mt-10" style="animation-delay: 0.3s;">
<a class="btn rounded-full border-0 bg-sage px-10 py-3 text-lg text-white shadow-lg transition hover:bg-sage-dark hover:shadow-xl" href={data.buttonUrl || '/book'}>
{data.buttonLabel}
</a>
</div>
{/if}
</div>
</section>

View file

@ -1,4 +1,6 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
type Card = { title: string; description: string; url?: string; link?: string };
let { data } = $props<{ data: { items?: Card[] } }>();
let items = $derived(data.items?.length ? data.items : [
@ -9,17 +11,17 @@
<section class="mx-auto max-w-6xl px-6 py-16">
<div class="mb-8">
<p class="mb-2 text-sm font-semibold uppercase tracking-[0.25em] text-sage-dark">Explore</p>
<h2 class="text-4xl md:text-5xl">Studio highlights</h2>
<h2 class="text-4xl md:text-5xl" use:scrollReveal>Studio highlights</h2>
</div>
<div class="flex gap-5 overflow-x-auto pb-4 md:grid md:grid-cols-3 md:overflow-visible">
{#each items as item}
<a class="min-w-[18rem] overflow-hidden rounded-[2rem] bg-white/75 shadow-sm ring-1 ring-charcoal/5 transition hover:-translate-y-1 hover:shadow-md md:min-w-0" href={item.link || '#'}>
{#each items as item, i}
<a use:scrollReveal={i * 0.1} class="reveal min-w-[18rem] overflow-hidden rounded-[2rem] bg-white/75 shadow-sm ring-1 ring-charcoal/5 transition hover:-translate-y-1 hover:shadow-md md:min-w-0" href={item.link || '#'}>
{#if item.url}
<img class="aspect-[4/3] w-full object-cover" src={item.url} alt="" />
{/if}
<div class="p-6">
<h3 class="text-2xl">{item.title}</h3>
<p class="mt-3 leading-7 text-charcoal/70">{item.description}</p>
<p class="mt-3 leading-7 text-fg-body/70">{item.description}</p>
</div>
</a>
{/each}

View file

@ -1,8 +1,10 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
let { data } = $props<{ data: { url?: string; alt?: string; caption?: string } }>();
</script>
<section class="mx-auto max-w-5xl px-6 py-10">
<section use:scrollReveal class="reveal mx-auto max-w-5xl px-6 py-10">
<figure class="overflow-hidden rounded-[2rem] bg-white/70 shadow-sm ring-1 ring-charcoal/5">
{#if data.url}
<img class="aspect-[16/10] w-full object-cover" src={data.url} alt={data.alt || ''} />
@ -10,7 +12,7 @@
<div class="grid aspect-[16/10] place-items-center bg-sage/10 text-sage-dark">Image coming soon</div>
{/if}
{#if data.caption}
<figcaption class="px-6 py-4 text-center text-sm text-charcoal/60">{data.caption}</figcaption>
<figcaption class="px-6 py-4 text-center text-sm text-fg-body/60">{data.caption}</figcaption>
{/if}
</figure>
</section>

View file

@ -1,10 +1,12 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
let { data } = $props<{
data: { url?: string; alt?: string; content?: string; imagePosition?: 'left' | 'right' };
}>();
</script>
<section class="mx-auto max-w-6xl px-6 py-14 md:py-20">
<section use:scrollReveal class="reveal mx-auto max-w-6xl px-6 py-14 md:py-20">
<div class="grid items-center gap-10 md:grid-cols-2">
<div class:md:order-2={data.imagePosition === 'right'} class="overflow-hidden rounded-[2rem] bg-sage/10 shadow-sm">
{#if data.url}
@ -13,7 +15,7 @@
<div class="grid aspect-[4/5] place-items-center text-sage-dark">Upload an image</div>
{/if}
</div>
<div class="prose-wellness text-lg text-charcoal/80">
<div class="prose-wellness text-lg text-fg-body/80">
{@html data.content || '<h2>A gentler rhythm</h2><p>Pair meaningful copy with a calming studio image.</p>'}
</div>
</div>

View file

@ -0,0 +1,23 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
let { data } = $props<{
data: {
heading?: string;
subtext?: string;
buttonLabel?: string;
placeholder?: string;
};
}>();
</script>
<section class="bg-sage/10 px-6 py-16 md:py-20">
<div use:scrollReveal class="reveal mx-auto max-w-2xl text-center">
<h2 class="text-3xl md:text-4xl">{data.heading || 'Want to stay connected?'}</h2>
<p class="mx-auto mt-5 max-w-xl leading-relaxed text-fg-body/70">{data.subtext || 'Sign up to receive updates.'}</p>
<form class="mx-auto mt-8 flex max-w-md gap-3" onsubmit={(e) => e.preventDefault()}>
<input class="input input-bordered flex-1 rounded-full bg-white px-6" type="email" placeholder={data.placeholder || 'Your email address'} required />
<button class="btn rounded-full border-0 bg-sage px-8 text-white hover:bg-sage-dark" type="submit">{data.buttonLabel || 'Subscribe'}</button>
</form>
</div>
</section>

View file

@ -0,0 +1,33 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
type PriceRow = { duration: string; price: string };
let { data } = $props<{
data: { heading?: string; items?: PriceRow[] };
}>();
let items = $derived(data.items?.length ? data.items : []);
</script>
<section class="mx-auto max-w-3xl px-6 py-16 md:py-20">
{#if data.heading}
<h2 use:scrollReveal class="reveal mb-10 text-center text-4xl md:text-5xl">{data.heading}</h2>
{/if}
<div use:scrollReveal class="reveal overflow-hidden rounded-[2rem] bg-white/75 shadow-sm ring-1 ring-charcoal/5">
<table class="w-full text-left">
<thead>
<tr class="border-b border-charcoal/10 bg-sage/5">
<th class="px-8 py-5 text-lg font-semibold text-fg-heading">Duration</th>
<th class="px-8 py-5 text-lg font-semibold text-fg-heading">Price</th>
</tr>
</thead>
<tbody>
{#each items as item}
<tr class="border-b border-charcoal/5 transition hover:bg-warm/50">
<td class="px-8 py-4 text-fg-body/80">{item.duration}</td>
<td class="px-8 py-4 font-semibold text-terracotta">{item.price}</td>
</tr>
{/each}
</tbody>
</table>
</div>
</section>

View file

@ -0,0 +1,57 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
let { data } = $props<{
data: {
name?: string;
tagline?: string;
image?: string;
description?: string;
education?: string[];
contact?: string;
profileUrl?: string;
};
}>();
</script>
<section class="mx-auto max-w-4xl px-6 py-16 md:py-20">
<div use:scrollReveal class="reveal grid items-start gap-10 md:grid-cols-[1fr_2fr]">
<div class="overflow-hidden rounded-[2rem] bg-sage/10 shadow-sm">
{#if data.image}
<img class="aspect-[3/4] w-full object-cover" src={data.image} alt={data.name || ''} />
{:else}
<div class="grid aspect-[3/4] place-items-center text-sage-dark">Photo</div>
{/if}
</div>
<div>
{#if data.name}
<h2 class="text-4xl md:text-5xl">{data.name}</h2>
{/if}
{#if data.tagline}
<p class="mt-2 text-lg font-medium text-sage-dark">{data.tagline}</p>
{/if}
{#if data.description}
<div class="prose-wellness mt-6 text-lg text-fg-body/80">{@html data.description}</div>
{/if}
{#if data.education?.length}
<div class="mt-8">
<h3 class="mb-3 text-xl font-semibold">Education</h3>
<ul class="space-y-2">
{#each data.education as edu}
<li class="flex items-start gap-3 text-fg-body/70">
<span class="mt-1.5 h-2 w-2 shrink-0 rounded-full bg-sage"></span>
{edu}
</li>
{/each}
</ul>
</div>
{/if}
{#if data.contact}
<p class="mt-6 text-fg-body/70">Contact: <a class="font-semibold text-sage-dark hover:text-terracotta" href={`tel:${data.contact}`}>{data.contact}</a></p>
{/if}
{#if data.profileUrl}
<a class="btn mt-6 rounded-full border-0 bg-sage text-white hover:bg-sage-dark" href={data.profileUrl} target="_blank" rel="noreferrer">View full profile</a>
{/if}
</div>
</div>
</section>

View file

@ -1,4 +1,6 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
type Service = { title: string; description: string; duration: string; price: string };
let { data } = $props<{ data: { items?: Service[] } }>();
let items = $derived(data.items?.length ? data.items : [
@ -9,16 +11,16 @@
<section class="mx-auto max-w-6xl px-6 py-16 md:py-20">
<div class="mb-10 text-center">
<p class="mb-2 text-sm font-semibold uppercase tracking-[0.25em] text-sage-dark">Treatments</p>
<h2 class="text-4xl md:text-5xl">Services</h2>
<h2 class="text-4xl md:text-5xl" use:scrollReveal>Services</h2>
</div>
<div class="grid gap-6 md:grid-cols-2">
{#each items as item}
<article class="group rounded-[2rem] bg-white/75 p-7 shadow-sm ring-1 ring-charcoal/5 transition hover:-translate-y-1 hover:shadow-md">
{#each items as item, i}
<article use:scrollReveal={i * 0.1} class="reveal group rounded-[2rem] bg-white/75 p-7 shadow-sm ring-1 ring-charcoal/5 transition hover:-translate-y-1 hover:shadow-md">
<div class="flex items-start justify-between gap-4">
<h3 class="text-2xl">{item.title}</h3>
<span class="rounded-full bg-sage/10 px-4 py-2 text-sm font-semibold text-sage-dark">{item.duration}</span>
</div>
<p class="mt-4 leading-7 text-charcoal/70">{item.description}</p>
<p class="mt-4 leading-7 text-fg-body/70">{item.description}</p>
<p class="mt-6 text-xl font-bold text-terracotta">{item.price}</p>
</article>
{/each}

View file

@ -1,4 +1,5 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
import { onMount } from 'svelte';
type Testimonial = { name: string; text: string; rating: number };
@ -26,7 +27,7 @@
});
</script>
<section class="bg-white/45 py-16 md:py-20" onmouseenter={() => (paused = true)} onmouseleave={() => (paused = false)} role="region" aria-label="Testimonials carousel">
<section use:scrollReveal class="reveal bg-white/45 py-16 md:py-20" onmouseenter={() => (paused = true)} onmouseleave={() => (paused = false)} role="region" aria-label="Testimonials carousel">
<div class="mx-auto max-w-5xl px-6">
<div class="mb-10 flex flex-col justify-between gap-4 md:flex-row md:items-end">
<div>
@ -44,7 +45,7 @@
<div class="carousel-item w-full transition-transform duration-500" style={`transform: translateX(-${index * 100}%);`}>
<article class="w-full p-8 md:p-12">
<div class="mb-5 text-xl text-terracotta" aria-label={`${item.rating} stars`}>{'★'.repeat(Math.max(1, Math.min(5, item.rating || 5)))}</div>
<p class="text-2xl leading-relaxed text-charcoal/80 md:text-3xl">“{item.text}”</p>
<p class="text-2xl leading-relaxed text-fg-body/80 md:text-3xl">“{item.text}”</p>
<p class="mt-6 font-semibold text-sage-dark">— {item.name}</p>
</article>
</div>

View file

@ -1,9 +1,11 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
let { data } = $props<{ data: { content?: string } }>();
</script>
<section class="mx-auto max-w-3xl px-6 py-12 md:py-16">
<div class="prose-wellness text-lg text-charcoal/85">
<section use:scrollReveal class="reveal mx-auto max-w-3xl px-6 py-12 md:py-16">
<div class="prose-wellness text-lg text-fg-body/85">
{@html data.content || '<h2>Welcome</h2><p>Add warm, inviting copy in the CMS.</p>'}
</div>
</section>

View file

@ -1,4 +1,6 @@
<script lang="ts">
import { scrollReveal } from '$lib/scrollReveal';
type TimelineItem = { year: string; title: string; description: string };
let { data } = $props<{ data: { items?: TimelineItem[] } }>();
let items = $derived(data.items?.length ? data.items : [
@ -9,16 +11,16 @@
<section class="mx-auto max-w-5xl px-6 py-16">
<div class="mb-12 text-center">
<p class="mb-2 text-sm font-semibold uppercase tracking-[0.25em] text-sage-dark">Journey</p>
<h2 class="text-4xl md:text-5xl">A practice shaped over time</h2>
<h2 class="text-4xl md:text-5xl" use:scrollReveal>A practice shaped over time</h2>
</div>
<div class="relative md:before:absolute md:before:left-1/2 md:before:top-0 md:before:h-full md:before:w-px md:before:bg-sage/30">
{#each items as item, index}
<div class="relative mb-8 grid gap-4 md:grid-cols-2 md:gap-12">
<div use:scrollReveal class="reveal relative mb-8 grid gap-4 md:grid-cols-2 md:gap-12">
<div class="hidden md:block" class:md:order-2={index % 2 === 0}></div>
<article class="rounded-3xl bg-white/75 p-6 shadow-sm ring-1 ring-charcoal/5" class:md:text-right={index % 2 === 0}>
<span class="text-sm font-bold uppercase tracking-[0.2em] text-terracotta">{item.year}</span>
<h3 class="mt-2 text-2xl">{item.title}</h3>
<p class="mt-3 leading-7 text-charcoal/70">{item.description}</p>
<p class="mt-3 leading-7 text-fg-body/70">{item.description}</p>
</article>
</div>
{/each}

View file

@ -0,0 +1,30 @@
/**
* Scroll reveal Svelte action — applies a CSS class when the element enters the viewport.
* Usage: <div use:scrollReveal class="reveal">...</div>
* The `reveal` class is hidden initially; `reveal-visible` is added on intersection.
*/
export function scrollReveal(node: HTMLElement, delay: number = 0) {
const observer = new IntersectionObserver(
(entries) => {
for (const entry of entries) {
if (entry.isIntersecting) {
if (delay > 0) {
node.style.transitionDelay = `${delay}s`;
}
node.classList.add('reveal-visible');
observer.unobserve(node);
}
}
},
{ threshold: 0.1, rootMargin: '0px 0px -40px 0px' }
);
observer.observe(node);
return {
destroy() {
observer.disconnect();
}
};
}

View file

@ -7,7 +7,28 @@ export type BlockType =
| 'services'
| 'cta'
| 'spacer'
| 'horizontal_cards';
| 'horizontal_cards'
| 'hero'
| 'columns'
| 'pricing_table'
| 'newsletter'
| 'articles_list'
| 'profile_card'
| 'features_list';
export type BlockBackground = {
type: 'none' | 'color' | 'image';
color: string;
imageUrl: string;
attachment: 'scroll' | 'fixed';
overlay: boolean;
overlayOpacity: number; // 0–100
};
export type BlockForeground = {
headingColor: string;
bodyColor: string;
};
export type ContentBlock = {
id: string;