scroller docs

This commit is contained in:
hobbes7878 2024-12-05 09:07:43 +00:00
parent 1a8be809d6
commit 613ba6e49f
2 changed files with 1 additions and 83 deletions

View file

@ -40,85 +40,3 @@ A more detailed example of using `Scroller` with graphics created by [ai2svelte]
embedded="{false}"
/>
```
When working with a ArchieML doc, here's an example of how you can tie your text into your steps.
```yaml
# Google doc block
Type: scroller
ID: map-scrolly
Step1Text: #### Step 1
Lorem Ipsum
:end
AltText1: A map showing the Upper West side in New York City.
:end
Step2Text: #### Step 2
Lorem Ipsum
:end
AltText2: The same map now highlights 98th Street.
:end
Step3Text: #### Step 3
Lorem Ipsum
:end
AltText3: The same map now highlights three locations near 98th Street where something particulary important happened.
:end
```
```svelte
<!-- App.svelte -->
<script>
// Previos imports and stuff...
// This should be already imported for you.
import content from '$locales/en/content.json';
// Get the data for the block in content by its ID
const scrollerBlock = content.blocks.find(
(block) => block.ID === 'map-scrolly'
);
// Now plug your text into your step foregrounds
const steps = [
{
background: MyAiMap1,
backgroundProps: { basePath: assets },
foreground: scrollerBlock.Step1Text,
altText: scrollerBlock.AltText1,
},
{
background: MyAiMap2,
backgroundProps: { basePath: assets },
foreground: scrollerBlock.Step2Text,
altText: scrollerBlock.AltText2,
},
{
background: MyAiMap3,
backgroundProps: { basePath: assets },
foreground: scrollerBlock.Step3Text,
altText: scrollerBlock.AltText3,
},
];
</script>
{#each content.blocks as block}
{#if block.Type === 'text'}
<!-- ... other blocks -->
<!-- Copy/paste into your blocks loop! -->
{:else if block.Type === 'scroller' && block.ID === 'map-scrolly'}
<Scroller
steps="{steps}"
backgroundWidth="fluid"
foregroundPosition="middle"
stackBackground="{true}"
embedded="{false}"
/>
<!-- END copy/paste -->
{/if}
{/each}
```

View file

@ -75,7 +75,7 @@ stackBackground: true
stackBackground="{block.stackBackground === 'true'}"
steps="{block.steps.map((step) => ({
background: aiCharts[step.background],
backgroundProps: assets || '/',
backgroundProps: { assetsPath: assets || '/' },
foreground: step.text,
altText: step.altText,
}))}"