@reuters-graphics/graphics-components 3.9.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/llm-docs/components/AdSlot.md +11 -0
- package/dist/llm-docs/components/Analytics.md +89 -0
- package/dist/llm-docs/components/Article.md +183 -0
- package/dist/llm-docs/components/BeforeAfter.md +170 -0
- package/dist/llm-docs/components/BioBox.md +74 -0
- package/dist/llm-docs/components/Block.md +211 -0
- package/dist/llm-docs/components/BlogPost.md +68 -0
- package/dist/llm-docs/components/BlogTOC.md +91 -0
- package/dist/llm-docs/components/BodyText.md +143 -0
- package/dist/llm-docs/components/Byline.md +242 -0
- package/dist/llm-docs/components/ClockWall.md +48 -0
- package/dist/llm-docs/components/DatawrapperChart.md +87 -0
- package/dist/llm-docs/components/DocumentCloud.md +47 -0
- package/dist/llm-docs/components/EmbedPreviewerLink.md +35 -0
- package/dist/llm-docs/components/EndNotes.md +79 -0
- package/dist/llm-docs/components/FeaturePhoto.md +102 -0
- package/dist/llm-docs/components/Framer.md +44 -0
- package/dist/llm-docs/components/Geocoder.md +49 -0
- package/dist/llm-docs/components/GraphicBlock.md +319 -0
- package/dist/llm-docs/components/Headline.md +248 -0
- package/dist/llm-docs/components/Headpile.md +55 -0
- package/dist/llm-docs/components/HeroHeadline.md +515 -0
- package/dist/llm-docs/components/HorizontalScroller.md +523 -0
- package/dist/llm-docs/components/InfoBox.md +196 -0
- package/dist/llm-docs/components/KinesisLogo.md +34 -0
- package/dist/llm-docs/components/LanguageButton.md +171 -0
- package/dist/llm-docs/components/Legend.md +251 -0
- package/dist/llm-docs/components/Lottie.md +464 -0
- package/dist/llm-docs/components/PaddingReset.md +78 -0
- package/dist/llm-docs/components/PhotoPack.md +237 -0
- package/dist/llm-docs/components/PymChild.md +49 -0
- package/dist/llm-docs/components/ReferralBlock.md +119 -0
- package/dist/llm-docs/components/ReutersGraphicsLogo.md +37 -0
- package/dist/llm-docs/components/ReutersLogo.md +35 -0
- package/dist/llm-docs/components/SEO.md +113 -0
- package/dist/llm-docs/components/Scroller.md +350 -0
- package/dist/llm-docs/components/ScrollerBase.md +104 -0
- package/dist/llm-docs/components/ScrollerVideo.md +576 -0
- package/dist/llm-docs/components/SearchInput.md +44 -0
- package/dist/llm-docs/components/ShareBar.md +78 -0
- package/dist/llm-docs/components/SimpleTimeline.md +141 -0
- package/dist/llm-docs/components/SiteFooter.md +77 -0
- package/dist/llm-docs/components/SiteHeader.md +55 -0
- package/dist/llm-docs/components/SiteHeadline.md +111 -0
- package/dist/llm-docs/components/Spinner.md +43 -0
- package/dist/llm-docs/components/Table.md +298 -0
- package/dist/llm-docs/components/Theme.md +266 -0
- package/dist/llm-docs/components/TileMap.md +477 -0
- package/dist/llm-docs/components/ToolsHeader.md +46 -0
- package/dist/llm-docs/components/Video.md +254 -0
- package/dist/llm-docs/components/Visible.md +54 -0
- package/dist/llm-docs/components/cssVariables.md +40 -0
- package/dist/llm-docs/components/index.md +59 -0
- package/dist/llm-docs/components/resizeObserver.md +21 -0
- package/dist/llm-docs/guides/archieml.md +406 -0
- package/dist/llm-docs/guides/colours.md +443 -0
- package/dist/llm-docs/guides/customising-with-scss.md +61 -0
- package/dist/llm-docs/guides/graphics-kit.md +25 -0
- package/dist/llm-docs/guides/index.md +16 -0
- package/dist/llm-docs/guides/intro.md +21 -0
- package/dist/llm-docs/guides/layout.md +13 -0
- package/dist/llm-docs/guides/llm-docs.md +71 -0
- package/dist/llm-docs/guides/styles.md +16 -0
- package/dist/llm-docs/guides/theming.md +100 -0
- package/dist/llm-docs/guides/tokens.md +150 -0
- package/dist/llm-docs/index.md +36 -0
- package/package.json +23 -3
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# PhotoPack
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Multimedia/PhotoPack
|
|
4
|
+
|
|
5
|
+
**Import:** `import { PhotoPack } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `images` | `Image[]` | — | ✓ | Array of image objects |
|
|
12
|
+
| `layouts` | `Layout[]` | — | | Array of layout objects |
|
|
13
|
+
| `gap` | `number` | `15` | | Gap between images. |
|
|
14
|
+
| `id` | `string` | `'photopack-' + random4() + random4()` | | Add an ID to target with SCSS. Should be unique from all other elements. |
|
|
15
|
+
| `class` | `string` | `''` | | Add a class to target with SCSS. |
|
|
16
|
+
| `width` | `ContainerWidth` | `'normal'` | | Width of the component within the text well: 'normal' \| 'wide' \| 'wider' \| 'widest' \| 'fluid' Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
|
|
17
|
+
| `textWidth` | `ContainerWidth` | `'normal'` | | Set a different width for captions within the text well. For example, "normal" to keep captions inline with the rest of the text well. Can't ever be wider than `width`: 'normal' \| 'wide' \| 'wider' \| 'widest' \| 'fluid' Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
|
|
18
|
+
|
|
19
|
+
## Types
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
export interface Image {
|
|
23
|
+
src: string;
|
|
24
|
+
altText: string;
|
|
25
|
+
caption?: string;
|
|
26
|
+
maxHeight?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Layout {
|
|
30
|
+
breakpoint: number;
|
|
31
|
+
rows: number[];
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Demo
|
|
38
|
+
|
|
39
|
+
```svelte
|
|
40
|
+
<PhotoPack
|
|
41
|
+
width="wide"
|
|
42
|
+
textWidth="normal"
|
|
43
|
+
images={/* array — see Props/Types for full type */}
|
|
44
|
+
layouts={[
|
|
45
|
+
{ breakpoint: 450, rows: [1, 2, 1] },
|
|
46
|
+
{ breakpoint: 750, rows: [1, 3] },
|
|
47
|
+
]}
|
|
48
|
+
/>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### ArchieML
|
|
52
|
+
|
|
53
|
+
```svelte
|
|
54
|
+
<PhotoPack archieMLBlock={/* object — see Props/Types for full type */} />
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Smart layouts
|
|
58
|
+
|
|
59
|
+
```svelte
|
|
60
|
+
{#snippet children(args)}
|
|
61
|
+
{@const { imageCount, ...photoPackProps } = args as SmartDefaultsArgs}
|
|
62
|
+
<PhotoPack
|
|
63
|
+
{...photoPackProps}
|
|
64
|
+
images={allImages.slice(0, imageCount || 4)}
|
|
65
|
+
/>
|
|
66
|
+
{/snippet}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Documentation
|
|
70
|
+
|
|
71
|
+
# PhotoPack
|
|
72
|
+
|
|
73
|
+
The `PhotoPack` component makes simple photo grids with custom layouts at various breakpoints.
|
|
74
|
+
|
|
75
|
+
`images` are defined with their src, alt text, captions and an optional `maxHeight`, which ensures that an image is no taller than that height in any layout.
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
const images = [
|
|
79
|
+
{
|
|
80
|
+
src: 'https://...',
|
|
81
|
+
altText: 'Alt text',
|
|
82
|
+
caption: 'Lorem ipsum. REUTERS/Photog',
|
|
83
|
+
// Optional max-height of images across all layouts
|
|
84
|
+
maxHeight: 800,
|
|
85
|
+
},
|
|
86
|
+
// ...
|
|
87
|
+
];
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`layouts` optionally define how images are laid out at different breakpoints. You can customise the layouts and group images into `rows` above a certain `breakpoint` by specifying the number of images that should go in that row. For example:
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
const layouts = [
|
|
94
|
+
{
|
|
95
|
+
breakpoint: 450,
|
|
96
|
+
rows: [1, 2, 1],
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
... tells the component that when the `PhotoPack` container is 450 pixels or wider, it should group the 4 images in 3 rows: 1 in the first, 2 in the second and 1 in the last.
|
|
102
|
+
|
|
103
|
+
If you don't specify any layouts, the component will use a default responsive layout based on the number of images in your pack.
|
|
104
|
+
|
|
105
|
+
You can define as many layouts for as many images as you like.
|
|
106
|
+
|
|
107
|
+
```svelte
|
|
108
|
+
<script>
|
|
109
|
+
import { PhotoPack } from '@reuters-graphics/graphics-components';
|
|
110
|
+
|
|
111
|
+
/** Array of photo metadata */
|
|
112
|
+
const images = [
|
|
113
|
+
{
|
|
114
|
+
src: 'https://...',
|
|
115
|
+
altText: 'Alt text',
|
|
116
|
+
caption: 'Lorem ipsum. REUTERS/Photog',
|
|
117
|
+
// Optional max-height of images across all layouts
|
|
118
|
+
maxHeight: 800,
|
|
119
|
+
},
|
|
120
|
+
// ...
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
/** Set the number of photos in each row at various breakpoints */
|
|
124
|
+
const layouts = [
|
|
125
|
+
{
|
|
126
|
+
breakpoint: 450, // Applies to containers wider than 450px
|
|
127
|
+
rows: [1, 2, 1], // Number of photos in each row
|
|
128
|
+
},
|
|
129
|
+
// Another layout for containers wider than 750px
|
|
130
|
+
{ breakpoint: 750, rows: [1, 3] },
|
|
131
|
+
];
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<PhotoPack {images} {layouts} />
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Using with ArchieML docs
|
|
138
|
+
|
|
139
|
+
With the graphics kit, you'll likely get your text value from an ArchieML doc...
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
# ArchieML doc
|
|
143
|
+
[blocks]
|
|
144
|
+
type: photo-pack
|
|
145
|
+
id: my-photo-pack # Optional
|
|
146
|
+
class: mb-2 # Optional
|
|
147
|
+
width: wide # Optional
|
|
148
|
+
textWidth: normal # Optional
|
|
149
|
+
gap: 10 # Optional; must be a number.
|
|
150
|
+
|
|
151
|
+
# Array of image metadata
|
|
152
|
+
[.images]
|
|
153
|
+
src: images/my-img-1.jpg
|
|
154
|
+
altText: Alt text
|
|
155
|
+
caption: Lorem ipsum. REUTERS/Photog
|
|
156
|
+
|
|
157
|
+
src: images/my-img-2.jpg
|
|
158
|
+
altText: Alt text
|
|
159
|
+
caption: Lorem ipsum. REUTERS/Photog
|
|
160
|
+
|
|
161
|
+
...
|
|
162
|
+
[]
|
|
163
|
+
|
|
164
|
+
[]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
... which you'll parse out of a ArchieML block object before passing to the `PhotoPack` component.
|
|
168
|
+
|
|
169
|
+
> **Important ❗**: The prop `gap` must be a number. ArchieML renders all values -- including numbers -- as strings, so convert the `prop` value to a number before passing it to `PhotoPack`.
|
|
170
|
+
|
|
171
|
+
```svelte
|
|
172
|
+
<!-- App.svelte -->
|
|
173
|
+
<script>
|
|
174
|
+
import { PhotoPack } from '@reuters-graphics/graphics-components';
|
|
175
|
+
import { assets } from '$app/paths'; // 👈 If using in the graphics kit...
|
|
176
|
+
|
|
177
|
+
import content from '$locales/en/content.json';
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
{#each content.blocks as block}
|
|
181
|
+
{#if block.type === 'photo-pack'}
|
|
182
|
+
<!-- Pass `assets` into the image source in graphics kit -->
|
|
183
|
+
<PhotoPack
|
|
184
|
+
id={block.id}
|
|
185
|
+
class={block.class}
|
|
186
|
+
width={block.width}
|
|
187
|
+
textWidth={block.textWidth}
|
|
188
|
+
gap={Number(block.gap)}
|
|
189
|
+
images={block.images.map((img) => ({
|
|
190
|
+
...img,
|
|
191
|
+
src: `${assets}/${img.src}`,
|
|
192
|
+
}))}
|
|
193
|
+
layouts={[
|
|
194
|
+
{ breakpoint: 750, rows: [2, 3] },
|
|
195
|
+
{ breakpoint: 450, rows: [1, 2, 2] },
|
|
196
|
+
]}
|
|
197
|
+
/>
|
|
198
|
+
{/if}
|
|
199
|
+
{/each}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Smart default layouts
|
|
203
|
+
|
|
204
|
+
If you don't specify the `layouts` prop, `PhotoPack` will automatically generate responsive layouts based on the number of images and the container width.
|
|
205
|
+
|
|
206
|
+
**How it works:**
|
|
207
|
+
|
|
208
|
+
- **Desktop** (1024px+): Number of images per row depends on container width:
|
|
209
|
+
- `normal`: max 2 per row
|
|
210
|
+
- `wide` / `wider`: max 3 per row
|
|
211
|
+
- `widest` / `fluid`: max 4 per row
|
|
212
|
+
- **Tablet** (768px+): Always max 2 per row
|
|
213
|
+
- **Mobile** (below 768px): 1 per row
|
|
214
|
+
|
|
215
|
+
The smart defaults use a **bottom-heavy distribution**, meaning earlier rows have fewer images (making them larger and more prominent), while later rows have more images.
|
|
216
|
+
|
|
217
|
+
**Examples:**
|
|
218
|
+
|
|
219
|
+
- 5 images, `wide` container, desktop: `[2, 3]` (2 in first row, 3 in second)
|
|
220
|
+
- 7 images, `widest` container, desktop: `[3, 4]` (3 in first row, 4 in second)
|
|
221
|
+
- 4 images, any container, desktop: `[2, 2]` (evenly distributed)
|
|
222
|
+
|
|
223
|
+
```svelte
|
|
224
|
+
<script>
|
|
225
|
+
import { PhotoPack } from '@reuters-graphics/graphics-components';
|
|
226
|
+
|
|
227
|
+
const images = [
|
|
228
|
+
{ src: `${assets}/image1.jpg`, altText: 'Photo 1', caption: 'Caption 1' },
|
|
229
|
+
{ src: `${assets}/image2.jpg`, altText: 'Photo 2', caption: 'Caption 2' },
|
|
230
|
+
{ src: `${assets}/image3.jpg`, altText: 'Photo 3', caption: 'Caption 3' },
|
|
231
|
+
{ src: `${assets}/image4.jpg`, altText: 'Photo 4', caption: 'Caption 4' },
|
|
232
|
+
];
|
|
233
|
+
</script>
|
|
234
|
+
|
|
235
|
+
<!-- No layouts prop = smart defaults! -->
|
|
236
|
+
<PhotoPack {images} width="wide" />
|
|
237
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# PymChild
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Utilities/PymChild
|
|
4
|
+
|
|
5
|
+
**Import:** `import { PymChild } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `polling` | `number` | `500` | | Pym.js polling interval |
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
### Demo
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<PymChild />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
# PymChild
|
|
24
|
+
|
|
25
|
+
The `PymChild` component creates a [Pym.js](https://blog.apps.npr.org/pym.js/) child instance for embeddables.
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<script>
|
|
29
|
+
import { PymChild } from '@reuters-graphics/graphics-components';
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<PymChild polling={500} />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
You can access the Pym.js child via `pym` in other components to send custom height updates to parent frames:
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<script>
|
|
39
|
+
import { PymChild, pym } from '@reuters-graphics/graphics-components';
|
|
40
|
+
|
|
41
|
+
const updateHeight = () => {
|
|
42
|
+
if (pym.child) pym.child.sendHeight();
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<PymChild />
|
|
47
|
+
|
|
48
|
+
<button onclick={updateHeight}>Update height</button>
|
|
49
|
+
```
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# ReferralBlock
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Page furniture/ReferralBlock
|
|
4
|
+
|
|
5
|
+
**Import:** `import { ReferralBlock } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `section` | `string` | `'/world/'` | | Section ID, which is often the URL path to the section page on reuters.com. Note that not all section pages will be available in the recent stories by section API. Options: `/world/`, `/world/europe/`, `/lifestyle/`, `/lifestyle/sports/`, `/legal/`, `/business/`, `/business/energy/` |
|
|
12
|
+
| `collection` | `string` | — | | Collection alias, as defined in Arc Collections editor. |
|
|
13
|
+
| `stories` | `ReferralItem[]` | `[]` | | Provide your own referrals instead of fetching recent stories from Reuters.com. When set, the `section`/`collection` fetch is skipped and these stories are rendered as-is. |
|
|
14
|
+
| `number` | `number` | `4` | | Number of referrals to show. Options: `2`, `4`, `6`, `8` |
|
|
15
|
+
| `linkTarget` | `LinkTarget` | `'_self'` | | Link [target](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target), e.g., `_blank` or `_parent`. |
|
|
16
|
+
| `heading` | `string` | `''` | | Add a heading to the referral block. |
|
|
17
|
+
| `width` | `ReferralBlockWidth` | `'wide'` | | Width of the component within the text well: 'normal' \| 'wide' \| 'wider' \| 'widest' \| 'fluid' Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
|
|
18
|
+
| `id` | `string` | `''` | | Add an ID to target with SCSS. |
|
|
19
|
+
| `class` | `string` | `'fmy-8'` | | Add a class to target with SCSS. |
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
### Demo
|
|
24
|
+
|
|
25
|
+
```svelte
|
|
26
|
+
<ReferralBlock section="/lifestyle/sports/" class="fmy-0" heading="More World Cup coverage" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### By collection
|
|
30
|
+
|
|
31
|
+
```svelte
|
|
32
|
+
<ReferralBlock collection="x-trump" number={6} class="fmy-8" heading="The latest Trump coverage" />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Manual stories
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<ReferralBlock
|
|
39
|
+
class="fmy-0"
|
|
40
|
+
heading="Related coverage"
|
|
41
|
+
stories={/* array — see Props/Types for full type */}
|
|
42
|
+
/>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Documentation
|
|
46
|
+
|
|
47
|
+
# ReferralBlock
|
|
48
|
+
|
|
49
|
+
The `ReferralBlock` component creates a set of referral links from recent Reuters.com stories using the [recent stories by section API](https://www.reuters.com/pf/api/v3/content/fetch/recent-stories-by-sections-v1?query=%7B%22section_ids%22%3A%22%2Fworld%2F%22%2C%22size%22%3A20%2C%22website%22%3A%22reuters%22%7D).
|
|
50
|
+
|
|
51
|
+
> Note: The `section` or `collection` prop determines which section or collection stories are from.
|
|
52
|
+
>
|
|
53
|
+
> You can get the section ID from the URL for the Reuters.com section pages. For example, the section ID for [World - Europe](https://www.reuters.com/world/europe/) stories at `www.reuters.com/world/europe/` would be `/world/europe/`. (The leading and trailing slashes are required!)
|
|
54
|
+
>
|
|
55
|
+
> You should get the collection alias from the dotcom team.
|
|
56
|
+
|
|
57
|
+
```svelte
|
|
58
|
+
<script>
|
|
59
|
+
import { ReferralBlock } from '@reuters-graphics/graphics-components';
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<ReferralBlock
|
|
63
|
+
section="/lifestyle/sports/"
|
|
64
|
+
class="fmy-0"
|
|
65
|
+
heading="More World Cup coverage"
|
|
66
|
+
/>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Collections
|
|
70
|
+
|
|
71
|
+
TK - Check if this is still relevant.
|
|
72
|
+
|
|
73
|
+
```svelte
|
|
74
|
+
<script>
|
|
75
|
+
import { ReferralBlock } from '@reuters-graphics/graphics-components';
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<ReferralBlock collection="x-trump" number={6} class="fmy-8" />
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Manual stories
|
|
82
|
+
|
|
83
|
+
Pass a `stories` array to populate the block with your own one-off referrals
|
|
84
|
+
instead of fetching them over the wire. When `stories` is set, the
|
|
85
|
+
`section`/`collection` fetch is skipped entirely and your stories render as-is —
|
|
86
|
+
which also means they show up in any environment, not just production
|
|
87
|
+
`www.reuters.com`.
|
|
88
|
+
|
|
89
|
+
Each story matches the `ReferralItem` type. Only `url`, `kicker`, `title` and
|
|
90
|
+
`imageUrl` are required; `imageAlt` and `time` are optional (omit `time` to hide
|
|
91
|
+
the publish time).
|
|
92
|
+
|
|
93
|
+
```svelte
|
|
94
|
+
<script>
|
|
95
|
+
import { ReferralBlock } from '@reuters-graphics/graphics-components';
|
|
96
|
+
|
|
97
|
+
const stories = [
|
|
98
|
+
{
|
|
99
|
+
url: 'https://www.reuters.com/world/europe/',
|
|
100
|
+
kicker: 'Europe',
|
|
101
|
+
title: 'A hand-picked story you provide yourself',
|
|
102
|
+
imageUrl: 'https://www.reuters.com/your-thumbnail.jpg',
|
|
103
|
+
imageAlt: 'Describe the image',
|
|
104
|
+
time: new Date('2026-06-16T12:00:00Z'),
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
url: 'https://www.reuters.com/business/energy/',
|
|
108
|
+
kicker: 'Energy',
|
|
109
|
+
title: 'Another one-off referral with no publish time',
|
|
110
|
+
imageUrl: 'https://www.reuters.com/another-thumbnail.jpg',
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<ReferralBlock {stories} heading="Related coverage" class="fmy-0" />
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# ReutersGraphicsLogo
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Logos/ReutersGraphicsLogo
|
|
4
|
+
|
|
5
|
+
**Import:** `import { ReutersGraphicsLogo } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `logoColour` | `string` | `'#D64000'` | | "Kinesis" colour |
|
|
12
|
+
| `textColour` | `string` | `'#212223'` | | Text colour |
|
|
13
|
+
| `width` | `string` | `'100%'` | | CSS width value |
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Demo
|
|
18
|
+
|
|
19
|
+
```svelte
|
|
20
|
+
<ReutersGraphicsLogo />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
# ReutersGraphicsLogo
|
|
26
|
+
|
|
27
|
+
The `ReutersGraphicsLogo` component contains the Reuters Graphics team logo.
|
|
28
|
+
|
|
29
|
+
> Generally, used only for internal tools. For public pages, use the [ReutersLogo](./?path=/docs/components-logos-reuterslogo--docs) component.
|
|
30
|
+
|
|
31
|
+
```svelte
|
|
32
|
+
<script>
|
|
33
|
+
import { ReutersGraphicsLogo } from '@reuters-graphics/graphics-components';
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<ReutersGraphicsLogo />
|
|
37
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# ReutersLogo
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Logos/ReutersLogo
|
|
4
|
+
|
|
5
|
+
**Import:** `import { ReutersLogo } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `logoColour` | `string` | `'#D64000'` | | "Kinesis" colour |
|
|
12
|
+
| `textColour` | `string` | `'#212223'` | | Text colour |
|
|
13
|
+
| `width` | `string` | `'100%'` | | CSS width value |
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Demo
|
|
18
|
+
|
|
19
|
+
```svelte
|
|
20
|
+
<ReutersLogo />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
# ReutersLogo
|
|
26
|
+
|
|
27
|
+
The `ReutersLogo` component contains the official Reuters logo.
|
|
28
|
+
|
|
29
|
+
```svelte
|
|
30
|
+
<script>
|
|
31
|
+
import { ReutersLogo } from '@reuters-graphics/graphics-components';
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<ReutersLogo />
|
|
35
|
+
```
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# SEO
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Ads & analytics/SEO
|
|
4
|
+
|
|
5
|
+
**Import:** `import { SEO } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `baseUrl` | `string` | — | ✓ | Base url for the page, which in [Vite-based projects](https://vitejs.dev/guide/build.html#public-base-path) is globally available as `import.meta.env.BASE_URL`. |
|
|
12
|
+
| `pageUrl` | `URL` | — | ✓ | [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) object for the page. |
|
|
13
|
+
| `seoTitle` | `string` | — | ✓ | SEO title |
|
|
14
|
+
| `seoDescription` | `string` | — | ✓ | SEO description |
|
|
15
|
+
| `shareTitle` | `string` | — | ✓ | Share title |
|
|
16
|
+
| `shareDescription` | `string` | — | ✓ | Share description |
|
|
17
|
+
| `shareImgPath` | `string` | — | ✓ | Share image path. **Must be an absolute path.** |
|
|
18
|
+
| `shareImgAlt` | `string` | `''` | | Share image alt text, up to 420 characters. |
|
|
19
|
+
| `publishTime` | `string` | `''` | | Publish time as an [ISO string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) |
|
|
20
|
+
| `updateTime` | `string` | `''` | | Updated time as an [ISO string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) |
|
|
21
|
+
| `authors` | `GraphicAuthor[]` | `[]` | | Array of authors for the piece. Each author object must have `name` and `link` attributes. |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### Demo
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<SEO
|
|
29
|
+
baseUrl="https://www.reuters.com"
|
|
30
|
+
seoTitle="A title for Google"
|
|
31
|
+
seoDescription="A description for Google"
|
|
32
|
+
shareTitle="A title for Twitter/Facebook"
|
|
33
|
+
shareDescription="A description for Twitter/Facebook"
|
|
34
|
+
shareImgPath="https://www.reuters.com/graphics/world-coronavirus-tracker-and-maps/assets/images/share.jpg"
|
|
35
|
+
/>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
# SEO
|
|
41
|
+
|
|
42
|
+
The `SEO` component adds essential metadata to pages.
|
|
43
|
+
|
|
44
|
+
```svelte
|
|
45
|
+
<script>
|
|
46
|
+
import { SEO } from '@reuters-graphics/graphics-components';
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<SEO
|
|
50
|
+
baseUrl="https://www.reuters.com/graphics/world-coronavirus-tracker-and-maps"
|
|
51
|
+
pageUrl={new URL(
|
|
52
|
+
'https://www.reuters.com/graphics/world-coronavirus-tracker-and-maps/countries/united-kingdom/'
|
|
53
|
+
)}
|
|
54
|
+
seoTitle="A title for Google"
|
|
55
|
+
seoDescription="A description for Google"
|
|
56
|
+
shareTitle="A title for Twitter/Facebook"
|
|
57
|
+
shareDescription="A description for Twitter/Facebook"
|
|
58
|
+
shareImgPath="https://www.reuters.com/graphics/world-coronavirus-tracker-and-maps/assets/images/share.jpg"
|
|
59
|
+
shareImgAlt="An image showing global COVID infection rates"
|
|
60
|
+
publishTime="2020-09-15T00:00:00.000Z"
|
|
61
|
+
updateTime="2021-01-10T12:30:00.000Z"
|
|
62
|
+
authors={[
|
|
63
|
+
{ name: 'Jane Doe', link: 'https://www.reuters.com/authors/jane-doe/' },
|
|
64
|
+
{ name: 'John Doe', link: 'https://www.reuters.com/authors/john-doe/' },
|
|
65
|
+
]}
|
|
66
|
+
/>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Using with ArchieML docs
|
|
70
|
+
|
|
71
|
+
With the graphics kit, you'll likely get many of your text values from an ArchieML doc...
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
# ArchieML doc
|
|
75
|
+
slug: ROOT-SLUG/WILD
|
|
76
|
+
seoTitle: Page title for search
|
|
77
|
+
seoDescription: Page description for search
|
|
78
|
+
shareTitle: Page title for social media
|
|
79
|
+
shareDescription: Page description for social media
|
|
80
|
+
shareImgPath: images/reuters-graphics.jpg
|
|
81
|
+
shareImgAlt: Alt text for share image.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
... which you'll pass to the `SEO` component.
|
|
85
|
+
|
|
86
|
+
```svelte
|
|
87
|
+
<script>
|
|
88
|
+
import { SEO } from '@reuters-graphics/graphics-components';
|
|
89
|
+
import pkg from '$pkg';
|
|
90
|
+
import content from '$locales/en/content.json';
|
|
91
|
+
import { assets } from '$app/paths';
|
|
92
|
+
import { page } from '$app/stores';
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<SEO
|
|
96
|
+
baseUrl={VITE_BASE_URL}
|
|
97
|
+
pageUrl={$page.url}
|
|
98
|
+
seoTitle={content.seoTitle}
|
|
99
|
+
seoDescription={content.seoDescription}
|
|
100
|
+
shareTitle={content.shareTitle}
|
|
101
|
+
shareDescription={content.shareDescription}
|
|
102
|
+
shareImgPath={`${assets}/${content.shareImgPath}`}
|
|
103
|
+
shareImgAlt={content.shareImgAlt}
|
|
104
|
+
publishTime={pkg?.reuters?.graphic?.published}
|
|
105
|
+
updateTime={pkg?.reuters?.graphic?.updated}
|
|
106
|
+
authors={pkg?.reuters?.graphic?.authors}
|
|
107
|
+
/>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> **Note:** For _reasons_, we can't document the value of `VITE_BASE_URL` below. It's `import` + `.meta.env.BASE_URL` (concatenate all that) in the graphics kit and other Vite-based rigs.
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
```
|