1.5 KiB
1.5 KiB
Setup your Google Doc with the images, layouts and other props you want:
# Google doc block
Type: photo-pack
ID: my-photo-pack
Class: mb-2 # adjust margin class as needed
Width: wide
TextWidth: normal
Gap: 10
[.Images]
Src: images/my-img-1.jpg
AltText: Alt text
Caption: Lorem ipsum. REUTERS/Photog
MaxHeight: 600 # Optional max-height
Src: images/my-img-2.jpg
AltText: Alt text
Caption: Lorem ipsum. REUTERS/Photog
Src: images/my-img-3.jpg
AltText: Alt text
Caption: Lorem ipsum. REUTERS/Photog
Src: images/my-img-4.jpg
AltText: Alt text
Caption: Lorem ipsum. REUTERS/Photog
Src: images/my-img-5.jpg
AltText: Alt text
Caption: Lorem ipsum. REUTERS/Photog
[]
[.Layouts]
Breakpoint: 750
Rows: 2,3 # Must add to total number of images!
Breakpoint: 450
Rows: 1,2,2
[]
In your project, you can use the getPhotoPackPropsFromDoc utilty to easily convert the GoogleDoc format above into the props the PhotoPack component expects.
<!-- App.svelte -->
<script>
import {
getPhotoPackPropsFromDoc,
PhotoPack,
} from '@reuters-graphics/graphics-components';
// These should be already imported for you.
import content from '$locales/en/content.json';
import { assets } from '$app/paths';
</script>
{#each content.blocks as block}
{#if block.Type === 'text'}
<!-- ... other blocks -->
<!-- Copy/paste into your blocks loop! -->
{:else if block.Type === 'photo-pack'}
<PhotoPack {...getPhotoPackPropsFromDoc(block, assets)} />
<!-- END copy/paste -->
{/if}
{/each}