{#snippet field(label: string, value: string, onInput: (value: string) => void, placeholder = '')} {/snippet} {#if !block}
Select a block to edit.
{:else}

{blockLabels[block.type as BlockType]}

{#if block.type === 'text'} updateData({ content })} /> {:else if block.type === 'image_text'}
updateData(image)} /> updateData({ imagePosition: v })} /> updateData({ content })} />
{:else if block.type === 'timeline'}
{#each block.data.items || [] as item, i}
Item {i + 1}
updateArray('items', i, { title: e.currentTarget.value })} />
{/each}
{:else if block.type === 'hero'} {@render field('Heading', block.data.heading || '', (heading) => updateData({ heading }))} {@render field('Subheading', block.data.subheading || '', (subheading) => updateData({ subheading }))}
{@render field('Button label', block.data.buttonLabel || '', (buttonLabel) => updateData({ buttonLabel }))} {@render field('Button URL', block.data.buttonUrl || '', (buttonUrl) => updateData({ buttonUrl }), '/page or https://…')}
{:else if block.type === 'button'}
{@render field('Button label', block.data.label || '', (label) => updateData({ label }))} {@render field('URL', block.data.href || '', (href) => updateData({ href }), '/page or https://…')}
updateData({ variant: v })} /> updateData({ alignment: v })} /> updateData({ size: v })} formatLabel={(v) => sizeLabels[String(v)] || String(v)} /> updateData({ color })} />
{:else if block.type === 'spacer'} {:else if block.type === 'testimonials'} {@render field('Section title', block.data.title || '', (title) => updateData({ title }))}
{#each block.data.items || [] as item, i}
Testimonial {i + 1}
updateArray('items', i, { title: e.currentTarget.value })} />
{/each}
{:else if block.type === 'upcoming_calendar'} {@render field('Section title', block.data.title || '', (title) => updateData({ title }))}

Category filters

Choose categories to show in this block. Leave all unselected to show every published event.

{#if eventCategories?.length}
{#each eventCategories as category} {/each}
{:else}

No event categories exist yet. Add categories to events under Events first.

{/if}
{:else if block.type === 'shop'} {:else if block.type === 'checkout'} {/if}
updateBackground({ type })} /> {#if block.data._background?.type === 'color'} updateBackground({ color })} /> {:else if block.data._background?.type === 'image'} updateBackground({ imageUrl: image.url, imageAlt: image.alt })} /> updateBackground({ attachment })} /> updateBackground({ overlay: Number(v) > 0, overlayOpacity: Number(v) })} formatLabel={(v) => (Number(v) === 0 ? 'None' : `${v}%`)} /> {/if}
updateForeground({ mode })} /> {#if block.data._foreground?.mode === 'custom'} updateForeground({ headingColor })} /> updateForeground({ subheadingColor })} /> updateForeground({ textColor })} /> {/if}
{/if}