@reuters-graphics/graphics-components 3.10.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 +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# AdSlot
|
|
2
|
+
|
|
3
|
+
**Import:** `import { AdSlot } from '@reuters-graphics/graphics-components'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Required | Description |
|
|
8
|
+
|------|------|---------|:--------:|-------------|
|
|
9
|
+
| `placementName` | `DesktopPlacementName \| MobilePlacementName` | — | ✓ | — |
|
|
10
|
+
| `adType` | `DesktopAdType \| MobileAdType` | — | ✓ | — |
|
|
11
|
+
| `dataFreestarAd` | `string` | `'__970x250'` | | — |
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Analytics
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Ads & analytics/Analytics
|
|
4
|
+
|
|
5
|
+
**Import:** `import { Analytics } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `authors` | `Author[]` | `[]` | | Used to associate a page with its author(s) in Chartbeat. |
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
### Demo
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<Analytics authors={[{ name: 'Jane Doe' }, { name: 'John Doe' }]} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
# Analytics
|
|
24
|
+
|
|
25
|
+
The `Analytics` component adds Google and Chartbeat analytics to your page.
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<script>
|
|
29
|
+
import { Analytics } from '@reuters-graphics/graphics-components';
|
|
30
|
+
|
|
31
|
+
const authors = [{ name: 'Jane Doe' }, { name: 'John Doe' }];
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<Analytics {authors} />
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Environments
|
|
38
|
+
|
|
39
|
+
Generally, you only want to send page analytics in production environments.
|
|
40
|
+
|
|
41
|
+
In a SvelteKit context, you can use `$app` stores to restrict when you send analytics.
|
|
42
|
+
|
|
43
|
+
For example, the following excludes analytics from pages in development or hosted on our preview server:
|
|
44
|
+
|
|
45
|
+
```svelte
|
|
46
|
+
<script>
|
|
47
|
+
import { Analytics } from '@reuters-graphics/graphics-components';
|
|
48
|
+
import { dev } from '$app/environment';
|
|
49
|
+
import { page } from '$app/stores';
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
{#if !dev && $page.url?.hostname !== 'graphics.thomsonreuters.com'}
|
|
53
|
+
<Analytics />
|
|
54
|
+
{/if}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Multipage apps
|
|
58
|
+
|
|
59
|
+
If you're using analytics to measure a multipage newsapp that uses [client-side routing](https://kit.svelte.dev/docs/glossary#routing), then you may need to trigger analytics after virtual page navigation.
|
|
60
|
+
|
|
61
|
+
This component exports a function you can call to register pageviews.
|
|
62
|
+
|
|
63
|
+
For example, here's how you can use SvelteKit's [`afterNavigate`](https://kit.svelte.dev/docs/modules#$app-navigation-afternavigate) lifecycle to capture additional pageviews:
|
|
64
|
+
|
|
65
|
+
```svelte
|
|
66
|
+
<script>
|
|
67
|
+
import {
|
|
68
|
+
Analytics,
|
|
69
|
+
registerPageview,
|
|
70
|
+
} from '@reuters-graphics/graphics-components';
|
|
71
|
+
import { afterNavigate } from '$app/navigation';
|
|
72
|
+
|
|
73
|
+
let isFirstPageview = true;
|
|
74
|
+
|
|
75
|
+
afterNavigate(() => {
|
|
76
|
+
// We shouldn't fire on initial page load because the Analytics component
|
|
77
|
+
// already registers a reader's first pageview. After this component
|
|
78
|
+
// has initially mounted, we can be sure that further navigation is virtual
|
|
79
|
+
// and register pageviews using this function.
|
|
80
|
+
if (!isFirstPageview) {
|
|
81
|
+
registerPageview();
|
|
82
|
+
} else {
|
|
83
|
+
isFirstPageview = false;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<Analytics />
|
|
89
|
+
```
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Article
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Page layout/Article
|
|
4
|
+
|
|
5
|
+
**Import:** `import { Article } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `embedded` | `boolean` | `false` | | Set to true for embeddables. |
|
|
12
|
+
| `id` | `string` | `''` | | Add an id to the article tag to target it with custom CSS. |
|
|
13
|
+
| `role` | `string \| null` | `null` | | ARIA role of the article |
|
|
14
|
+
| `columnWidths` | `ColumnWidths` | `{
|
|
15
|
+
narrower: 330,
|
|
16
|
+
narrow: 510,
|
|
17
|
+
normal: 660,
|
|
18
|
+
wide: 930,
|
|
19
|
+
wider: 1200,
|
|
20
|
+
}` | | Set custom widths for the normal, wide and wider column dimensions |
|
|
21
|
+
| `children` | `import('svelte').Snippet` | — | | — |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### Demo
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<Article id="article-story-basic">
|
|
29
|
+
<div class="demo-container">
|
|
30
|
+
<div class="background-label">Article well</div>
|
|
31
|
+
<div class="padding-label"><span>⇤</span>15px padding</div>
|
|
32
|
+
</div>
|
|
33
|
+
</Article>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Custom columns
|
|
37
|
+
|
|
38
|
+
```svelte
|
|
39
|
+
<h3>Default column widths</h3>
|
|
40
|
+
|
|
41
|
+
<Article id="article-column-widths-demo">
|
|
42
|
+
<div class="article-boundaries">
|
|
43
|
+
<Block id="section-demo" width="narrower">narrower</Block>
|
|
44
|
+
<Block id="section-demo" width="narrow">narrow</Block>
|
|
45
|
+
<Block id="section-demo">normal</Block>
|
|
46
|
+
<Block id="section-demo" width="wide">wide</Block>
|
|
47
|
+
<Block id="section-demo" width="wider">wider</Block>
|
|
48
|
+
<Block id="section-demo" width="widest">widest</Block>
|
|
49
|
+
<Block id="section-demo" width="fluid">fluid</Block>
|
|
50
|
+
</div>
|
|
51
|
+
</Article>
|
|
52
|
+
<h3>Custom column widths</h3>
|
|
53
|
+
<Article
|
|
54
|
+
id="article-column-widths-demo"
|
|
55
|
+
columnWidths={{
|
|
56
|
+
narrower: 250,
|
|
57
|
+
narrow: 400,
|
|
58
|
+
normal: 500,
|
|
59
|
+
wide: 675,
|
|
60
|
+
wider: 1400,
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<div class="article-boundaries custom">
|
|
64
|
+
<Block id="section-demo" width="narrower">narrower</Block>
|
|
65
|
+
<Block id="section-demo" width="narrow">narrow</Block>
|
|
66
|
+
<Block id="section-demo">normal</Block>
|
|
67
|
+
<Block id="section-demo" width="wide">wide</Block>
|
|
68
|
+
<Block id="section-demo" width="wider">wider</Block>
|
|
69
|
+
<Block id="section-demo" width="widest">widest</Block>
|
|
70
|
+
<Block id="section-demo" width="fluid">fluid</Block>
|
|
71
|
+
</div>
|
|
72
|
+
</Article>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Documentation
|
|
76
|
+
|
|
77
|
+
# Article
|
|
78
|
+
|
|
79
|
+
The `Article` component contains all the contents of our story.
|
|
80
|
+
|
|
81
|
+
> 📌 In most cases, **you don't need to mess with the `Article` component** because it's already set up in the graphics kit.
|
|
82
|
+
|
|
83
|
+
```svelte
|
|
84
|
+
<script>
|
|
85
|
+
import { Article } from '@reuters-graphics/graphics-components';
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<Article>
|
|
89
|
+
<!-- The story content goes here! -->
|
|
90
|
+
</Article>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Custom column widths
|
|
94
|
+
|
|
95
|
+
The `Article` component also establishes the widths of columns that contain individual sections of the story, such as text, photos, and charts. The default column widths follow a basic class scheme:
|
|
96
|
+
|
|
97
|
+
- `narrower` The narrowest...
|
|
98
|
+
- `narrow` A bit narrower than the default body text column
|
|
99
|
+
- `normal` **The default width of the body text column**
|
|
100
|
+
- `wide` A bit wider
|
|
101
|
+
- `wider` A bit wider than wide...
|
|
102
|
+
- `widest` Edge-to-edge, but _excluding_ the left and right padding on `Article`
|
|
103
|
+
- `fluid` Fully edge-to-edge
|
|
104
|
+
|
|
105
|
+
You can set custom column widths by passing an object to the `columnWidths` prop with pixel values for the `narrower`, `narrow`, `normal`, `wide` and `wider` classes. These can then be used by the `Block` component or other elements housed inside `<Article>`.
|
|
106
|
+
|
|
107
|
+
> **For most graphics kit pages, you shouldn't customise the column widths.** Other Reuters tools, like our AI templates, use our default column widths, so customising those widths here has downstream consequences for graphics made outside graphics kit. The main exception is SREP stories.
|
|
108
|
+
|
|
109
|
+
```svelte
|
|
110
|
+
<!-- Set custom column widths -->
|
|
111
|
+
<Article
|
|
112
|
+
columnWidths={{
|
|
113
|
+
narrower: 310,
|
|
114
|
+
narrow: 450,
|
|
115
|
+
normal: 550,
|
|
116
|
+
wide: 675,
|
|
117
|
+
wider: 1400,
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<!-- Custom column widths get passed down to the `Block` component -->
|
|
121
|
+
<Block width="narrower" />
|
|
122
|
+
<Block width="narrow" />
|
|
123
|
+
<Block width="normal" />
|
|
124
|
+
<Block width="wide" />
|
|
125
|
+
<Block width="wider" />
|
|
126
|
+
<Block width="widest" />
|
|
127
|
+
<Block width="fluid" />
|
|
128
|
+
</Article>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
If you're not using our `Block` component, you can still inherit the column widths from `Article` and create your own custom containers by using [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) like this:
|
|
132
|
+
|
|
133
|
+
```svelte
|
|
134
|
+
<div class="my-special-container">
|
|
135
|
+
<!-- Story content -->
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<style lang="scss">
|
|
139
|
+
div.my-special-container {
|
|
140
|
+
max-width: var(--wide-column-width);
|
|
141
|
+
}
|
|
142
|
+
</style>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
... or you can make your column widths entirely configurable by adding classes and manually specifying widths:
|
|
146
|
+
|
|
147
|
+
```svelte
|
|
148
|
+
<script>
|
|
149
|
+
let { width = 'normal' } = $props();
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<div class="my-special-container {width}">
|
|
153
|
+
<!-- Story content -->
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<style lang="scss">
|
|
157
|
+
div.my-special-container {
|
|
158
|
+
max-width: var(--normal-column-width);
|
|
159
|
+
&.narrower {
|
|
160
|
+
max-width: var(--narrower-column-width);
|
|
161
|
+
}
|
|
162
|
+
&.narrow {
|
|
163
|
+
max-width: var(--narrow-column-width);
|
|
164
|
+
}
|
|
165
|
+
&.wide {
|
|
166
|
+
max-width: var(--wide-column-width);
|
|
167
|
+
}
|
|
168
|
+
&.wider {
|
|
169
|
+
max-width: var(--wider-column-width);
|
|
170
|
+
}
|
|
171
|
+
&.widest {
|
|
172
|
+
max-width: 100%;
|
|
173
|
+
}
|
|
174
|
+
&.fluid {
|
|
175
|
+
width: calc(100% + 30px);
|
|
176
|
+
margin-inline-start: -15px;
|
|
177
|
+
max-width: none;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
</style>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Here's an example of how `columnWidths` can be used to change column widths:
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# BeforeAfter
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Multimedia/BeforeAfter
|
|
4
|
+
|
|
5
|
+
**Import:** `import { BeforeAfter } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `width` | `ContainerWidth` | `'normal'` | | Width of the chart within the text well. Options: wide, wider, widest, fluid Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
|
|
12
|
+
| `height` | `number` | `600` | | Height of the component |
|
|
13
|
+
| `heightRatio` | `number` | — | | If set, makes the height a ratio of the component's width. |
|
|
14
|
+
| `beforeSrc` | `string` | — | ✓ | Before image source |
|
|
15
|
+
| `beforeAlt` | `string` | — | ✓ | Before image altText |
|
|
16
|
+
| `afterSrc` | `string` | — | ✓ | After image source |
|
|
17
|
+
| `afterAlt` | `string` | — | ✓ | After image altText |
|
|
18
|
+
| `class` | `string` | `''` | | Class to target with SCSS. |
|
|
19
|
+
| `handleColour` | `string` | `'white'` | | Drag handle colour |
|
|
20
|
+
| `handleInactiveOpacity` | `number` | `0.9` | | Drag handle opacity |
|
|
21
|
+
| `handleMargin` | `number` | `20` | | Margin at the edge of the image to stop dragging |
|
|
22
|
+
| `keyPressStep` | `number` | `0.05` | | Percentage of the component width the handle will travel ona key press |
|
|
23
|
+
| `offset` | `number` | `0.5` | | Initial offset of the handle, between 0 and 1. |
|
|
24
|
+
| `id` | `string` | `'before-after-' + random4() + random4()` | | ID to target with SCSS. |
|
|
25
|
+
| `beforeOverlay` | `Snippet` | — | | Optional snippet for a custom overlay for the before image. |
|
|
26
|
+
| `afterOverlay` | `Snippet` | — | | Optional snippet for a custom overlay for the after image. |
|
|
27
|
+
| `caption` | `Snippet` | — | | Optional snippet for a custom caption. |
|
|
28
|
+
| `ariaLabel` | `string` | `'Stacked before and after images with an adjustable slider'` | | Custom ARIA label language to label the component. |
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
### Demo
|
|
33
|
+
|
|
34
|
+
```svelte
|
|
35
|
+
<BeforeAfter
|
|
36
|
+
beforeSrc={/* beforeImg */}
|
|
37
|
+
beforeAlt="Satellite image of Russian base at Myrne taken on July 7, 2020."
|
|
38
|
+
afterSrc={/* afterImg */}
|
|
39
|
+
afterAlt="Satellite image of Russian base at Myrne taken on Oct. 20, 2020."
|
|
40
|
+
/>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### With text
|
|
44
|
+
|
|
45
|
+
```svelte
|
|
46
|
+
<BeforeAfter
|
|
47
|
+
beforeSrc={beforeImg}
|
|
48
|
+
beforeAlt="Satellite image of Russian base at Myrne taken on July 7, 2020."
|
|
49
|
+
afterSrc={afterImg}
|
|
50
|
+
afterAlt="Satellite image of Russian base at Myrne taken on Oct. 20, 2020."
|
|
51
|
+
>
|
|
52
|
+
{#snippet beforeOverlay()}
|
|
53
|
+
<div class="overlay p-3 before">
|
|
54
|
+
<p class="h4 font-bold">July 7, 2020</p>
|
|
55
|
+
<p class="body-note">Initially, this site was far smaller.</p>
|
|
56
|
+
</div>
|
|
57
|
+
{/snippet}
|
|
58
|
+
{#snippet afterOverlay()}
|
|
59
|
+
<div class="overlay p-3 after">
|
|
60
|
+
<p class="h4 font-bold">Oct. 20, 2020</p>
|
|
61
|
+
<p class="body-note">But then forces built up.</p>
|
|
62
|
+
</div>
|
|
63
|
+
{/snippet}
|
|
64
|
+
{#snippet caption()}
|
|
65
|
+
<p class="body-note">Photos by MAXAR Technologies, 2021.</p>
|
|
66
|
+
{/snippet}
|
|
67
|
+
</BeforeAfter>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Documentation
|
|
71
|
+
|
|
72
|
+
# BeforeAfter
|
|
73
|
+
|
|
74
|
+
The `BeforeAfter` component shows a before-and-after comparison of an image.
|
|
75
|
+
|
|
76
|
+
```svelte
|
|
77
|
+
<script>
|
|
78
|
+
import { BeforeAfter } from '@reuters-graphics/graphics-components';
|
|
79
|
+
import { assets } from '$app/paths'; // 👈 If using in the graphics kit...
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<BeforeAfter
|
|
83
|
+
beforeSrc={`${assets}/images/before-after/myrne-before.jpg`}
|
|
84
|
+
beforeAlt="Satellite image of Russian base at Myrne taken on July 7, 2020."
|
|
85
|
+
afterSrc={`${assets}/images/before-after/myrne-after.jpg`}
|
|
86
|
+
afterAlt="Satellite image of Russian base at Myrne taken on Oct. 20, 2020."
|
|
87
|
+
/>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Using with ArchieML docs
|
|
91
|
+
|
|
92
|
+
With the graphics kit, you'll likely get your text value from an ArchieML doc...
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
# ArchieML doc
|
|
96
|
+
[blocks]
|
|
97
|
+
|
|
98
|
+
type: before-after
|
|
99
|
+
beforeSrc: images/before-after/myrne-before.jpg
|
|
100
|
+
beforeAlt: Satellite image of Russian base at Myrne taken on July 7, 2020.
|
|
101
|
+
afterSrc: images/before-after/myrne-after.jpg
|
|
102
|
+
afterAlt: Satellite image of Russian base at Myrne taken on Oct. 20, 2020.
|
|
103
|
+
|
|
104
|
+
[]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
... which you'll parse out of a ArchieML block object before passing to the `BeforeAfter` component.
|
|
108
|
+
|
|
109
|
+
```svelte
|
|
110
|
+
<!-- App.svelte -->
|
|
111
|
+
{#each content.blocks as block}
|
|
112
|
+
{#if block.type === 'before-after'}
|
|
113
|
+
<BeforeAfter
|
|
114
|
+
beforeSrc={`${assets}/${block.beforeSrc}`}
|
|
115
|
+
beforeAlt={block.beforeAlt}
|
|
116
|
+
afterSrc={`${assets}/${block.afterSrc}`}
|
|
117
|
+
afterAlt={block.afterAlt}
|
|
118
|
+
/>
|
|
119
|
+
{/if}
|
|
120
|
+
{/each}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Adding text
|
|
124
|
+
|
|
125
|
+
To add text overlays and captions, use [snippets](https://svelte.dev/docs/svelte/snippet) for `beforeOverlay`, `afterOverlay` and `caption`. You can style the snippets to match your page design, like in [this demo](./?path=/story/components-multimedia-beforeafter--with-overlays).
|
|
126
|
+
|
|
127
|
+
> 💡**NOTE:** The text in the overlays are used as [ARIA descriptions](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) for your before and after images. You must always use the `beforeAlt` / `afterAlt` props to label your image for visually impaired readers, but these ARIA descriptions provide additional information or context that the reader might need.
|
|
128
|
+
|
|
129
|
+
```svelte
|
|
130
|
+
<BeforeAfter
|
|
131
|
+
beforeSrc={beforeImg}
|
|
132
|
+
beforeAlt="Satellite image of Russian base at Myrne taken on July 7, 2020."
|
|
133
|
+
afterSrc={afterImg}
|
|
134
|
+
afterAlt="Satellite image of Russian base at Myrne taken on Oct. 20, 2020."
|
|
135
|
+
>
|
|
136
|
+
<!-- Optional custom text overlay for the before image -->
|
|
137
|
+
{#snippet beforeOverlay()}
|
|
138
|
+
<div class="overlay p-3 before text-left">
|
|
139
|
+
<p class="h4 font-bold">July 7, 2020</p>
|
|
140
|
+
<p class="body-note">Initially, this site was far smaller.</p>
|
|
141
|
+
</div>
|
|
142
|
+
{/snippet}
|
|
143
|
+
|
|
144
|
+
<!-- Optional custom text overlay for the after image -->
|
|
145
|
+
{#snippet afterOverlay()}
|
|
146
|
+
<div class="overlay p-3 after text-right">
|
|
147
|
+
<p class="h4 font-bold">Oct. 20, 2020</p>
|
|
148
|
+
<p class="body-note">But then forces built up.</p>
|
|
149
|
+
</div>
|
|
150
|
+
{/snippet}
|
|
151
|
+
|
|
152
|
+
<!-- Optional custom caption for both images -->
|
|
153
|
+
{#snippet caption()}
|
|
154
|
+
<p class="body-note">Photos by MAXAR Technologies, 2021.</p>
|
|
155
|
+
{/snippet}
|
|
156
|
+
</BeforeAfter>
|
|
157
|
+
|
|
158
|
+
<style lang="scss">
|
|
159
|
+
.overlay {
|
|
160
|
+
background: rgba(0, 0, 0, 0.45);
|
|
161
|
+
max-width: 350px;
|
|
162
|
+
&.after {
|
|
163
|
+
text-align: right;
|
|
164
|
+
}
|
|
165
|
+
p {
|
|
166
|
+
color: #ffffff;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
</style>
|
|
170
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# BioBox
|
|
2
|
+
|
|
3
|
+
BioBox shows one or more author biographies in a bordered box, echoing the contributor box on Reuters.com stories.
|
|
4
|
+
|
|
5
|
+
**Category:** Components/Page furniture/BioBox
|
|
6
|
+
|
|
7
|
+
**Import:** `import { BioBox } from '@reuters-graphics/graphics-components'`
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Required | Description |
|
|
12
|
+
|------|------|---------|:--------:|-------------|
|
|
13
|
+
| `authors` | `Author[]` | — | ✓ | Authors to display, in order. |
|
|
14
|
+
| `id` | `string` | `''` | | ID on the containing block. |
|
|
15
|
+
| `class` | `string` | `'fmy-8'` | | Extra classes on the containing block. |
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Demo
|
|
20
|
+
|
|
21
|
+
```svelte
|
|
22
|
+
<BioBox authors={/* authors */} />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Single author
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<BioBox authors={[authors[1]]} />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Logo fallback
|
|
32
|
+
|
|
33
|
+
```svelte
|
|
34
|
+
<BioBox authors={/* array — see Props/Types for full type */} />
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
# BioBox
|
|
40
|
+
|
|
41
|
+
The `BioBox` component shows one or more author biographies in a bordered box, echoing the contributor box at the bottom of Reuters.com stories.
|
|
42
|
+
|
|
43
|
+
Each author can include a name, job title, short bio, avatar image and a row of contact and social links (email, X, LinkedIn, Facebook, Instagram, Bluesky or a generic link). When no avatar is provided, the Reuters Kinesis logo is shown instead.
|
|
44
|
+
|
|
45
|
+
On narrow screens the social links move below the bio text so names and titles stay readable.
|
|
46
|
+
|
|
47
|
+
```svelte
|
|
48
|
+
<script>
|
|
49
|
+
import { BioBox } from '@reuters-graphics/graphics-components';
|
|
50
|
+
|
|
51
|
+
const authors = [
|
|
52
|
+
{
|
|
53
|
+
name: 'Ben Welsh',
|
|
54
|
+
title: 'News Applications Editor',
|
|
55
|
+
bio: 'Ben Welsh leads the development of dashboards, databases and other automated systems.',
|
|
56
|
+
imageUrl: 'https://www.reuters.com/.../avatar.jpg',
|
|
57
|
+
links: [
|
|
58
|
+
{ platform: 'email', url: 'ben.welsh@thomsonreuters.com' },
|
|
59
|
+
{ platform: 'x', url: 'https://x.com/palewire' },
|
|
60
|
+
{ platform: 'linkedin', url: 'https://www.linkedin.com/in/palewire' },
|
|
61
|
+
{ platform: 'link', url: 'https://palewi.re/who-is-ben-welsh/' },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<BioBox {authors} />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Single author
|
|
71
|
+
|
|
72
|
+
## Logo fallback
|
|
73
|
+
|
|
74
|
+
When an author has no `imageUrl`, the box falls back to the Reuters Kinesis logo.
|