diff --git a/src/components/Scroller/Background.svelte b/src/components/Scroller/Background.svelte index 4df7102c..51229738 100644 --- a/src/components/Scroller/Background.svelte +++ b/src/components/Scroller/Background.svelte @@ -10,19 +10,18 @@ let { index, steps, preload = 1, stackBackground = true }: Props = $props(); - function shouldShowStep(i:number) { + function shouldShowStep(i: number) { if (preload === 0) return true; if (stackBackground) return i <= index; return i >= index - preload && i <= index + preload; } - function isStepVisible(i:number) { + function isStepVisible(i: number) { if (stackBackground) return i <= index; return i === index; } - {#each steps as step, i} {#if shouldShowStep(i)}
**Important❗:** Make sure the HTML element containing each foreground is a div with the class `step-foreground-container`. If you're modifying this to something else, pass the appropriate selector to the `query` prop. + [Demo](?path=/story/components-graphics-scrollerbase--demo) ```svelte - - {#snippet backgroundSnippet()} - -
-

- This is the background content. It will stay fixed in place while the - foreground scrolls over the top. -

-
+ +

+ Current step: {index + 1}/{count} +

+ + +

Offset in current step

+ + +

Total progress

+ {/snippet} {#snippet foregroundSnippet()} - -
-

Index {myIndex}: This is the first section.

-
-
-

Index {myIndex}: This is the second section.

-
-
-

Index {myIndex}: This is the third section.

-
+ +
Step 1
+
Step 2
+
Step 3
+
Step 4
+
Step 5
{/snippet}
-``` -> **Important❗:** Make sure the HTML element containing each foreground is a div with the class `step-foreground-container`. If you're modifying this to something else, pass the appropriate selector to the `query` prop. + ``` diff --git a/src/components/ScrollerBase/ScrollerBase.stories.svelte b/src/components/ScrollerBase/ScrollerBase.stories.svelte index 28beac95..e8cbb78a 100644 --- a/src/components/ScrollerBase/ScrollerBase.stories.svelte +++ b/src/components/ScrollerBase/ScrollerBase.stories.svelte @@ -1,6 +1,7 @@ - - - - - {#snippet backgroundSnippet()} -
-

- This is the background content. It will stay fixed in place while the - foreground scrolls over the top. -

-
- {/snippet} - {#snippet foregroundSnippet()} -
-

Index {myIndex}: This is the first section.

-
-
-

Index {myIndex}: This is the second section.

-
-
-

Index {myIndex}: This is the third section.

-
- {/snippet} -
-
- - + diff --git a/src/components/ScrollerBase/demo/DraggableLabel.svelte b/src/components/ScrollerBase/demo/DraggableLabel.svelte new file mode 100644 index 00000000..fc3b3e55 --- /dev/null +++ b/src/components/ScrollerBase/demo/DraggableLabel.svelte @@ -0,0 +1,87 @@ + + +
(value = e.detail.value)} +> +
+
+

{label}: {round(value)}

+
+ + diff --git a/src/components/ScrollerBase/demo/ScrollerDemo.svelte b/src/components/ScrollerBase/demo/ScrollerDemo.svelte new file mode 100644 index 00000000..ef7dba35 --- /dev/null +++ b/src/components/ScrollerBase/demo/ScrollerDemo.svelte @@ -0,0 +1,80 @@ + + + + +
+ + {#snippet backgroundSnippet()} +

+ Current step: {index + 1}/{count} +

+ + +

Offset in current step

+ + +

Total progress

+ + {/snippet} + {#snippet foregroundSnippet()} +
Step 1
+
Step 2
+
Step 3
+
Step 4
+
Step 5
+ {/snippet} +
+
+ + + + + + + + diff --git a/src/components/Theme/@types/component.ts b/src/components/Theme/@types/component.ts index b08425b7..325faed0 100644 --- a/src/components/Theme/@types/component.ts +++ b/src/components/Theme/@types/component.ts @@ -50,5 +50,5 @@ export interface Theme { export interface CustomTheme { colour?: Partial; font?: Partial; - [customProperty: string]: unknown; + [customProperty: string]: unknown; }