fix: preserve landing page section content when toggled off (#838)

* preserve section content when toggled off

* Update types.ts

* Remove comment on LandingPageLinks enabled property

Removed comment about the default visibility of the section.

---------

Co-authored-by: Rotimi Best <[email protected]>
This commit is contained in:
Victor Jack
2026-08-11 14:31:58 +01:00
committed by GitHub
co-authored by Rotimi Best
parent 0dc32b5210
commit 6537613000
12 changed files with 102 additions and 101 deletions
+11 -11
View File
@@ -152,17 +152,17 @@ Composable page shell used across dashboard list and settings screens. Import as
The bar also sits at `z-50`, matching the editor root so it paints above editor content (later in DOM wins the tie) while staying below body-portaled dialogs and sheets. Its shadow appears only while it is pinned away from its flow position, tracked by an `IntersectionObserver` on a 1px sentinel rendered as its next sibling.
| Prop | Description |
| -------------- | -------------------------------------------------------- |
| `hasChanges` | Enables Save and Discard when the form is dirty |
| `loading` | Shows loading state on Save |
| `disabled` | Disables Save only (e.g. while not initialized) |
| `contentClass` | Extra classes on the inner card (width, padding, etc.) |
| `statusLabel` | Left-side status text (e.g. "Unsaved changes") |
| `discardLabel` | Discard button label |
| `saveLabel` | Save button label |
| `onSave` | Save handler |
| `onDiscard` | Discard handler |
| Prop | Description |
| -------------- | ------------------------------------------------------ |
| `hasChanges` | Enables Save and Discard when the form is dirty |
| `loading` | Shows loading state on Save |
| `disabled` | Disables Save only (e.g. while not initialized) |
| `contentClass` | Extra classes on the inner card (width, padding, etc.) |
| `statusLabel` | Left-side status text (e.g. "Unsaved changes") |
| `discardLabel` | Discard button label |
| `saveLabel` | Save button label |
| `onSave` | Save handler |
| `onDiscard` | Discard handler |
```svelte
<Page.Root>
@@ -107,7 +107,7 @@
`;
</script>
{#if callout}
{#if callout && callout.enabled !== false}
<EditableLandingSection sectionKey="callout">
<section
class={sectionClasses[variant]}
@@ -15,7 +15,7 @@
} = $props();
</script>
{#if embed}
{#if embed && embed.enabled !== false}
<EditableLandingSection sectionKey="embed">
{#if variant === 'terminal'}
<section class="ui:py-24 ui:px-6" style="border-top: 1px solid #1c1f28; background: #06070a;">
@@ -33,7 +33,7 @@
}
</script>
{#if links && links.cards.length > 0}
{#if links && links.enabled !== false && links.cards.length > 0}
<EditableLandingSection sectionKey="links">
{#if variant === 'minimal'}
<section class="ui:py-20 ui:px-4">
@@ -81,17 +81,17 @@
</div>
</section>
{#if links && links.cards.length > 0}
{#if links && links.enabled !== false && links.cards.length > 0}
<div class="plus-row"></div>
<OrgLandingPageLinks {links} {labels} variant="saas" />
{/if}
{#if embed}
{#if embed && embed.enabled !== false}
<div class="plus-row"></div>
<OrgLandingPageEmbed {embed} {labels} variant="saas" />
{/if}
{#if callout}
{#if callout && callout.enabled !== false}
<div class="plus-row"></div>
<OrgLandingPageCallout {callout} {labels} variant="saas" />
{/if}
@@ -91,6 +91,7 @@ export type OrgLandingPageFooterConfig = {
};
};
export type LandingPageEmbed = {
enabled?: boolean;
title: string;
description?: string;
code: string;
@@ -101,6 +102,7 @@ export type LandingPageEmbed = {
};
export type LandingPageCallout = {
enabled?: boolean;
heading: string;
description: string;
action: {
@@ -129,6 +131,7 @@ export type LandingPageLinkCard = {
};
export type LandingPageLinks = {
enabled?: boolean;
heading: string;
description?: string;
/** Bold template card footer chip (e.g. Visit). */