@reuters-graphics/graphics-components 3.10.0 → 4.0.0
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/components/Analytics/GTM.svelte.d.ts +3 -3
- package/dist/components/BlogPost/BlogPost.svelte +6 -5
- package/dist/components/BlogPost/BlogPost.svelte.d.ts +3 -2
- package/dist/components/BlogPost/CopyLink.svelte +7 -4
- package/dist/components/BlogPost/CopyLink.svelte.d.ts +5 -2
- package/dist/components/BlogPost/PostHeadline.svelte +7 -4
- package/dist/components/BlogPost/PostHeadline.svelte.d.ts +5 -2
- package/dist/components/BlogPost/utils.d.ts +2 -1
- package/dist/components/BlogPost/utils.js +8 -2
- package/dist/components/BlogTOC/BlogTOC.svelte +7 -4
- package/dist/components/BlogTOC/BlogTOC.svelte.d.ts +8 -5
- package/dist/components/BlogTOC/TOCList.svelte.d.ts +3 -3
- package/dist/components/Headpile/Headpile.svelte +2 -2
- package/dist/components/Headpile/Headpile.svelte.d.ts +2 -2
- package/dist/components/LanguageButton/LanguageButton.svelte +10 -7
- package/dist/components/LanguageButton/LanguageButton.svelte.d.ts +5 -2
- package/dist/components/SEO/SEO.svelte.d.ts +3 -3
- package/dist/components/Video/Video.svelte +2 -2
- 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 +66 -0
- package/dist/llm-docs/components/BlogTOC.md +89 -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 +170 -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 +238 -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 +18 -24
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# BodyText
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Text elements/BodyText
|
|
4
|
+
|
|
5
|
+
**Import:** `import { BodyText } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `text` | `string` | — | ✓ | A markdown text string. |
|
|
12
|
+
| `class` | `string` | `''` | | Add a class to target with SCSS. |
|
|
13
|
+
| `id` | `string` | `''` | | Add an id to the block tag to target it with custom CSS. |
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Demo
|
|
18
|
+
|
|
19
|
+
```svelte
|
|
20
|
+
<BodyText text={/* value — see Props/Types for full type */} />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Typography sample
|
|
24
|
+
|
|
25
|
+
```svelte
|
|
26
|
+
<BodyText
|
|
27
|
+
class="body-text-typography-example-story"
|
|
28
|
+
text={/* value — see Props/Types for full type */}
|
|
29
|
+
/>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Custom styles
|
|
33
|
+
|
|
34
|
+
```svelte
|
|
35
|
+
<BodyText
|
|
36
|
+
class="body-text-custom-styles-story"
|
|
37
|
+
text="Venison shoulder <span class="highlight">ham hock</span> ham leberkas."
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Documentation
|
|
42
|
+
|
|
43
|
+
# BodyText
|
|
44
|
+
|
|
45
|
+
The `BodyText` component creates the main text of your page. You can pass the `text` prop a [markdown-formatted](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) string, which will be parsed into paragraphs, headers, lists, links, blockquotes and other markdown-supported elements.
|
|
46
|
+
|
|
47
|
+
```svelte
|
|
48
|
+
<script>
|
|
49
|
+
import { BodyText } from '@reuters-graphics/graphics-components';
|
|
50
|
+
|
|
51
|
+
const markdownText = `Bacon ipsum **dolor amet** cow tongue tri-tip.
|
|
52
|
+
|
|
53
|
+
Biltong turducken ground round kevin [hamburger turkey](https://reuters.com) pig.
|
|
54
|
+
|
|
55
|
+
- Steak
|
|
56
|
+
- [Pork chop](https://www.google.com)
|
|
57
|
+
- Fillet
|
|
58
|
+
|
|
59
|
+
Venison shoulder *ham hock ham leberkas*. Flank beef ribs fatback, jerky meatball ham hock.`;
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<BodyText text={markdownText} />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Using with ArchieML docs
|
|
66
|
+
|
|
67
|
+
With the graphics kit, you'll likely get your text value from an ArchieML doc...
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
# ArchieML doc
|
|
71
|
+
[blocks]
|
|
72
|
+
|
|
73
|
+
type: text
|
|
74
|
+
text: Bacon ipsum ...
|
|
75
|
+
|
|
76
|
+
... etc.
|
|
77
|
+
:end
|
|
78
|
+
|
|
79
|
+
[]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
... which you'll parse out of a ArchieML block object before passing to the `BodyText` component.
|
|
83
|
+
|
|
84
|
+
```svelte
|
|
85
|
+
<!-- App.svelte -->
|
|
86
|
+
<script>
|
|
87
|
+
import { BodyText } from '@reuters-graphics/graphics-components';
|
|
88
|
+
import content from '$locales/en/content.json';
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
{#each content.blocks as block}
|
|
92
|
+
{#if block.type === 'text'}
|
|
93
|
+
<BodyText text={block.text} />
|
|
94
|
+
{/if}
|
|
95
|
+
{/each}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Styling text
|
|
99
|
+
|
|
100
|
+
Styles are built in for many text elements created by `BodyText`, including headings, ordered and unordered lists, links, blockquotes and even drop caps (using a `"drop-cap"` classed span).
|
|
101
|
+
|
|
102
|
+
```svelte
|
|
103
|
+
<BodyText
|
|
104
|
+
text="<span class='drop-cap'>R</span>eprehenderit hamburger pork bresaola ..."
|
|
105
|
+
/>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Custom styles
|
|
109
|
+
|
|
110
|
+
To add your own styling, you can write styles in a global SCSS stylesheet:
|
|
111
|
+
|
|
112
|
+
```svelte
|
|
113
|
+
<BodyText
|
|
114
|
+
text="Venison shoulder <span class='highlight'>ham hock</span> ham leberkas."
|
|
115
|
+
/>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```scss
|
|
119
|
+
// global.scss
|
|
120
|
+
span.highlight {
|
|
121
|
+
background: palegoldenrod;
|
|
122
|
+
padding: 2px 4px;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
If you want to make sure styles for one portion of text don't apply other parts of the page, add a `class` to BodyText to use as an additional selector.
|
|
127
|
+
|
|
128
|
+
```svelte highlight=2
|
|
129
|
+
<BodyText
|
|
130
|
+
class="my-special-text-block"
|
|
131
|
+
text="Venison shoulder <span class='highlight'>ham hock</span> ham leberkas."
|
|
132
|
+
/>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```scss
|
|
136
|
+
// global.scss
|
|
137
|
+
.my-special-text-block {
|
|
138
|
+
span.highlight {
|
|
139
|
+
background: palegoldenrod;
|
|
140
|
+
padding: 2px 4px;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# Byline
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Text elements/Byline
|
|
4
|
+
|
|
5
|
+
**Import:** `import { Byline } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `authors` | `string[]` | `[]` | | Array of author names, which will be slugified to create links to Reuters author pages |
|
|
12
|
+
| `publishTime` | `string` | `''` | | Publish time as a datetime string. |
|
|
13
|
+
| `updateTime` | `string` | — | | Update time as a datetime string. |
|
|
14
|
+
| `align` | `'auto' \| 'center'` | `'auto'` | | Alignment of the byline. Options: `auto`, `center` |
|
|
15
|
+
| `id` | `string` | `''` | | Add an id to to target with custom CSS. |
|
|
16
|
+
| `cls` | `string` | `''` | | Add extra classes to target with custom CSS. |
|
|
17
|
+
| `getAuthorPage` | `(author: string) => string` | `getAuthorPageUrl` | | Custom function that returns an author page URL. |
|
|
18
|
+
| `byline` | `Snippet` | — | | Optional snippet for a custom byline. |
|
|
19
|
+
| `published` | `Snippet` | — | | Optional snippet for a custom published dateline. |
|
|
20
|
+
| `updated` | `Snippet` | — | | Optional snippet for a custom updated dateline. |
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
### Demo
|
|
25
|
+
|
|
26
|
+
```svelte
|
|
27
|
+
<Byline
|
|
28
|
+
authors={/* authors */}
|
|
29
|
+
publishTime={new Date('2021-09-12').toISOString()}
|
|
30
|
+
updateTime={new Date('2021-09-12T13:57:00').toISOString()}
|
|
31
|
+
/>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Customised
|
|
35
|
+
|
|
36
|
+
```svelte
|
|
37
|
+
<Byline publishTime="2021-09-12T00:00:00Z" updateTime="2021-09-12T13:57:00Z">
|
|
38
|
+
{#snippet byline()}
|
|
39
|
+
<strong>BY REUTERS GRAPHICS</strong>
|
|
40
|
+
{/snippet}
|
|
41
|
+
{#snippet published()}
|
|
42
|
+
PUBLISHED on some custom date and time
|
|
43
|
+
{/snippet}
|
|
44
|
+
{#snippet updated()}
|
|
45
|
+
<em>Updated every 5 minutes</em>
|
|
46
|
+
{/snippet}
|
|
47
|
+
</Byline>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Translation
|
|
51
|
+
|
|
52
|
+
```svelte
|
|
53
|
+
In locale = `es`:
|
|
54
|
+
<Byline
|
|
55
|
+
publishTime="2021-09-12T00:00:00Z"
|
|
56
|
+
{authors}
|
|
57
|
+
byline={locale === 'es' ? esByline : undefined}
|
|
58
|
+
published={locale === 'es' ? esPublished : undefined}
|
|
59
|
+
></Byline>
|
|
60
|
+
|
|
61
|
+
In locale = `en`:
|
|
62
|
+
<Byline
|
|
63
|
+
publishTime="2021-09-12T00:00:00Z"
|
|
64
|
+
{authors}
|
|
65
|
+
byline={undefined}
|
|
66
|
+
published={undefined}
|
|
67
|
+
/>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Custom author page
|
|
71
|
+
|
|
72
|
+
```svelte
|
|
73
|
+
<Byline
|
|
74
|
+
authors={/* authors */}
|
|
75
|
+
publishTime="2021-09-12T00:00:00Z"
|
|
76
|
+
updateTime="2021-09-12T13:57:00Z"
|
|
77
|
+
getAuthorPage={(author: string) => {
|
|
78
|
+
return `mailto:${author.replace(' ', '')}@example.com`;
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Documentation
|
|
84
|
+
|
|
85
|
+
# Byline
|
|
86
|
+
|
|
87
|
+
The `Byline` component adds a byline, published and updated datelines to your page.
|
|
88
|
+
|
|
89
|
+
```svelte
|
|
90
|
+
<script>
|
|
91
|
+
import { Byline } from '@reuters-graphics/graphics-components';
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<Byline
|
|
95
|
+
authors={[
|
|
96
|
+
'Dea Bankova',
|
|
97
|
+
'Prasanta Kumar Dutta',
|
|
98
|
+
'Anurag Rao',
|
|
99
|
+
'Mariano Zafra',
|
|
100
|
+
]}
|
|
101
|
+
publishTime="2021-09-12T00:00:00.000Z"
|
|
102
|
+
updateTime="2021-09-12T12:57:00.000Z"
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Using with ArchieML docs
|
|
107
|
+
|
|
108
|
+
With the graphics kit, you'll likely get your text value from an ArchieML doc...
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
# ArchieML doc
|
|
112
|
+
[authors]
|
|
113
|
+
* Dea Bankova
|
|
114
|
+
* Prasanta Kumar Dutta
|
|
115
|
+
* Anurag Rao
|
|
116
|
+
* Mariano Zafra
|
|
117
|
+
[]
|
|
118
|
+
publishTime: 2021-09-12T00:00:00.000Z
|
|
119
|
+
updateTime: 2021-09-12T12:57:00.000Z
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
... which you'll pass to the `Byline` component.
|
|
123
|
+
|
|
124
|
+
```svelte
|
|
125
|
+
<script>
|
|
126
|
+
import { Byline } from '@reuters-graphics/graphics-components';
|
|
127
|
+
let { content }: Props = $props();
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<Byline
|
|
131
|
+
authors={content.authors}
|
|
132
|
+
publishTime={content.publishTime}
|
|
133
|
+
updateTime={content.updateTime}
|
|
134
|
+
/>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Custom byline, published and updated datelines
|
|
138
|
+
|
|
139
|
+
Use [snippets](https://svelte.dev/docs/svelte/snippet) to customise the byline, published and updated datelines.
|
|
140
|
+
|
|
141
|
+
```svelte
|
|
142
|
+
<Byline publishTime="2021-09-12T00:00:00Z" updateTime="2021-09-12T13:57:00Z">
|
|
143
|
+
<!-- Optional custom byline -->
|
|
144
|
+
{#snippet byline()}
|
|
145
|
+
<strong>BY REUTERS GRAPHICS</strong>
|
|
146
|
+
{/snippet}
|
|
147
|
+
|
|
148
|
+
<!-- Optional custom published dateline -->
|
|
149
|
+
{#snippet published()}
|
|
150
|
+
PUBLISHED on some custom date and time
|
|
151
|
+
{/snippet}
|
|
152
|
+
|
|
153
|
+
<!-- Optional custom updated dateline -->
|
|
154
|
+
{#snippet updated()}
|
|
155
|
+
<em>Updated every 5 minutes</em>
|
|
156
|
+
{/snippet}
|
|
157
|
+
</Byline>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Translated byline and datelines
|
|
161
|
+
|
|
162
|
+
Use [snippets](https://svelte.dev/docs/svelte/snippet) to conditionally customise the byline, published and updated datelines for different languages.
|
|
163
|
+
|
|
164
|
+
```svelte
|
|
165
|
+
<!-- In App.svelte -->
|
|
166
|
+
<script>
|
|
167
|
+
import {
|
|
168
|
+
Byline,
|
|
169
|
+
getAuthorPageUrl,
|
|
170
|
+
formatTime,
|
|
171
|
+
} from '@reuters-graphics/graphics-components';
|
|
172
|
+
|
|
173
|
+
let { content }: Props = $props();
|
|
174
|
+
|
|
175
|
+
// Note: In graphics kit, `locale` is already defined in `App.svelte`
|
|
176
|
+
</script>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```svelte
|
|
180
|
+
<!-- In App.svelte -->
|
|
181
|
+
<!-- Define custom translation snippets for different languages above the <Byline/> component -->
|
|
182
|
+
{#snippet esByline()}
|
|
183
|
+
Por
|
|
184
|
+
{#each content.authors as author, i}
|
|
185
|
+
<a
|
|
186
|
+
class="no-underline whitespace-nowrap text-primary font-bold"
|
|
187
|
+
href={getAuthorPageUrl(author)}
|
|
188
|
+
rel="author"
|
|
189
|
+
>
|
|
190
|
+
{author.trim()}</a
|
|
191
|
+
>{#if content.authors.length > 1 && i < content.authors.length - 2},{/if}
|
|
192
|
+
{#if content.authors.length > 1 && i === content.authors.length - 2}y {/if}
|
|
193
|
+
{/each}
|
|
194
|
+
{/snippet}
|
|
195
|
+
|
|
196
|
+
{#snippet esPublished()}
|
|
197
|
+
Publicado <time datetime="2026-04-08T10:00:00.000Z">
|
|
198
|
+
{new Date(content.publishTime).toLocaleDateString('es-ES', {
|
|
199
|
+
year: 'numeric',
|
|
200
|
+
month: 'long',
|
|
201
|
+
day: 'numeric',
|
|
202
|
+
})} {formatTime(content.publishTime)}</time
|
|
203
|
+
>
|
|
204
|
+
{/snippet}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
```svelte
|
|
208
|
+
<!-- In App.svelte -->
|
|
209
|
+
<!-- Conditionally render custom translation snippets depending on the locale -->
|
|
210
|
+
<Byline
|
|
211
|
+
authors={content.authors}
|
|
212
|
+
publishTime={content.publishTime}
|
|
213
|
+
byline={locale === 'es' ? esByline : undefined}
|
|
214
|
+
published={locale === 'es' ? esPublished : undefined}
|
|
215
|
+
/>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Custom author page
|
|
219
|
+
|
|
220
|
+
By default, the `Byline` component will hyperlink each author's byline to their Reuters.com page, formatted `https://www.reuters.com/authors/{author-slug}/`.
|
|
221
|
+
|
|
222
|
+
To hyperlink to different pages or email addresses, pass a custom function to the `getAuthorPage` prop.
|
|
223
|
+
|
|
224
|
+
```svelte
|
|
225
|
+
<!-- Pass a custom function as `getAuthorPage` -->
|
|
226
|
+
<Byline
|
|
227
|
+
authors={[
|
|
228
|
+
'Dea Bankova',
|
|
229
|
+
'Prasanta Kumar Dutta',
|
|
230
|
+
'Anurag Rao',
|
|
231
|
+
'Mariano Zafra',
|
|
232
|
+
]}
|
|
233
|
+
publishTime="2021-09-12T00:00:00Z"
|
|
234
|
+
updateTime="2021-09-12T13:57:00Z"
|
|
235
|
+
getAuthorPage={(author) => {
|
|
236
|
+
return `mailto:${author.replace(' ', '')}@example.com`;
|
|
237
|
+
}}
|
|
238
|
+
/>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# ClockWall
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Blog/ClockWall
|
|
4
|
+
|
|
5
|
+
**Import:** `import { ClockWall } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `cities` | `City[]` | `[
|
|
12
|
+
{ name: 'Tehran', tzIdentifier: 'Asia/Tehran' },
|
|
13
|
+
{ name: 'Tel Aviv', tzIdentifier: 'Asia/Tel_Aviv' },
|
|
14
|
+
{ name: 'Washington D.C.', tzIdentifier: 'America/New_York' },
|
|
15
|
+
]` | | — |
|
|
16
|
+
| `width` | `ContainerWidth` | `'normal'` | | — |
|
|
17
|
+
| `clockSize` | `ClockProps['clockSize']` | `'XS'` | | — Options: `XS`, `MD`, `LG`, `XL` |
|
|
18
|
+
| `clockWeight` | `ClockProps['clockWeight']` | `'Bold'` | | — Options: `Light`, `Normal`, `Bold` |
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
### Demo
|
|
23
|
+
|
|
24
|
+
```svelte
|
|
25
|
+
<ClockWall />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Documentation
|
|
29
|
+
|
|
30
|
+
# ClockWall
|
|
31
|
+
|
|
32
|
+
The `ClockWall` component displays a row of analog clocks for different cities and timezones. Use it paired with the overall headline of a graphics blog page to show the time of multiple cities involved in a breaking news event.
|
|
33
|
+
|
|
34
|
+
Use the [IANA tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to find valid `tzIdentifier` strings.
|
|
35
|
+
|
|
36
|
+
```svelte
|
|
37
|
+
<script>
|
|
38
|
+
import { ClockWall } from '@reuters-graphics/graphics-components';
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<ClockWall
|
|
42
|
+
cities={[
|
|
43
|
+
{ name: 'Tehran', tzIdentifier: 'Asia/Tehran' },
|
|
44
|
+
{ name: 'Tel Aviv', tzIdentifier: 'Asia/Tel_Aviv' },
|
|
45
|
+
{ name: 'Washington D.C.', tzIdentifier: 'America/New_York' },
|
|
46
|
+
]}
|
|
47
|
+
/>
|
|
48
|
+
```
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# DatawrapperChart
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Graphics/DatawrapperChart
|
|
4
|
+
|
|
5
|
+
**Import:** `import { DatawrapperChart } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `title` | `string` | — | | Title of the graphic |
|
|
12
|
+
| `description` | `string` | — | | Description of the graphic, passed in as a markdown string. |
|
|
13
|
+
| `frameTitle` | `string` | `''` | | iframe title |
|
|
14
|
+
| `notes` | `string` | — | | Notes to the graphic, passed in as a markdown string. |
|
|
15
|
+
| `ariaLabel` | `string` | `''` | | iframe aria label |
|
|
16
|
+
| `id` | `string` | `''` | | — |
|
|
17
|
+
| `src` | `string` | — | ✓ | Datawrapper embed URL |
|
|
18
|
+
| `scrolling` | `ScrollingOption` | `'no'` | | iframe scrolling option |
|
|
19
|
+
| `width` | `ContainerWidth` | `'normal'` | | Width of the chart within the text well. Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
|
|
20
|
+
| `textWidth` | `ContainerWidth` | `'normal'` | | Set a different width for the text within the text well, for example, "normal" to keep the title, description and notes inline with the rest of the text well. Can't ever be wider than `width`. |
|
|
21
|
+
| `titleSnippet` | `Snippet` | — | | Custom headline and chatter snippet |
|
|
22
|
+
| `notesSnippet` | `Snippet` | — | | Custom notes and source snippet |
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
### Demo
|
|
27
|
+
|
|
28
|
+
```svelte
|
|
29
|
+
<DatawrapperChart
|
|
30
|
+
src="https://reuters.com/graphics/USA-ABORTION/lgpdwggnwvo/media-embed.html"
|
|
31
|
+
id="abortion-rights-map"
|
|
32
|
+
ariaLabel="map"
|
|
33
|
+
frameTitle="Global abortion access"
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### With chatter
|
|
38
|
+
|
|
39
|
+
```svelte
|
|
40
|
+
<DatawrapperChart
|
|
41
|
+
frameTitle="Global abortion access"
|
|
42
|
+
ariaLabel="map"
|
|
43
|
+
id="abortion-rights-map"
|
|
44
|
+
src="https://reuters.com/graphics/USA-ABORTION/lgvdwemlbpo/media-embed.html"
|
|
45
|
+
title="Global abortion access"
|
|
46
|
+
description="A map of worldwide access to abortion."
|
|
47
|
+
notes={/* value — see Props/Types for full type */}
|
|
48
|
+
/>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
# DatawrapperChart
|
|
54
|
+
|
|
55
|
+
Easily add a responsive Datawrapper embed on your page.
|
|
56
|
+
|
|
57
|
+
```svelte
|
|
58
|
+
<script>
|
|
59
|
+
import { DatawrapperChart } from '@reuters-graphics/graphics-components';
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<DatawrapperChart
|
|
63
|
+
title="Global abortion access"
|
|
64
|
+
ariaLabel="map"
|
|
65
|
+
id="abortion-rights-map"
|
|
66
|
+
src="https://graphics.reuters.com/USA-ABORTION/lgpdwggnwvo/media-embed.html"
|
|
67
|
+
/>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
##### Getting the chart URL for `src`
|
|
71
|
+
|
|
72
|
+
Copy the source url for the Datawrapper chart in the `src` prop.
|
|
73
|
+
You can get this from the published url on Reuters Graphics.
|
|
74
|
+
|
|
75
|
+
- Publish the chart on Datawrapper.
|
|
76
|
+
- Go to the **Datawrapper charts** Teams channel, wait for the graphic to finish publishing.
|
|
77
|
+
- Inside **Embed code (for developers only)**, find and copy the url inside the `src` prop. (It ends in `media-embed.html`.)
|
|
78
|
+
|
|
79
|
+
**Note:** There is no need to update the url if you update the chart inside Datawrapper. Any changes will be automatically reflected.
|
|
80
|
+
|
|
81
|
+
## With chatter
|
|
82
|
+
|
|
83
|
+
By default, Datawrapper will export your chart with the chart chatter like title, description and notes.
|
|
84
|
+
|
|
85
|
+
At the moment, these don't _exactly_ match our styles and can't be made to fit into the article well.
|
|
86
|
+
|
|
87
|
+
Instead, it's often better to remove all the text from your Datawrapper chart before publishing it and add that text back via the component props.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# DocumentCloud
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Multimedia/DocumentCloud
|
|
4
|
+
|
|
5
|
+
**Import:** `import { DocumentCloud } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `slug` | `string` | — | ✓ | The unique identifier for the document. |
|
|
12
|
+
| `altText` | `string` | — | ✓ | Alt text for the document. |
|
|
13
|
+
| `width` | `ContainerWidth` | `'normal'` | | Width of the container, one of: normal, wide, wider, widest or fluid Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
|
|
14
|
+
| `id` | `string` | `''` | | Add an ID to target with SCSS. |
|
|
15
|
+
| `class` | `string` | `''` | | Add a class to target with SCSS. |
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Demo
|
|
20
|
+
|
|
21
|
+
```svelte
|
|
22
|
+
<DocumentCloud
|
|
23
|
+
slug="3259984-Trump-Intelligence-Allegations"
|
|
24
|
+
altText="These Reports Allege Trump Has Deep Ties To Russia"
|
|
25
|
+
/>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Documentation
|
|
29
|
+
|
|
30
|
+
# DocumentCloud
|
|
31
|
+
|
|
32
|
+
The `DocumentCloud` component embeds a document hosted by [DocumentCloud](https://documentcloud.org).
|
|
33
|
+
|
|
34
|
+
The document must have its access level set to **public** before it can be embedded. The `slug` can be found after the final slash in the document's URL.
|
|
35
|
+
|
|
36
|
+
For instance, the document included in the example is found at [documentcloud.org/documents/3259984-Trump-Intelligence-Allegations](https://www.documentcloud.org/documents/3259984-Trump-Intelligence-Allegations). The `slug` is `3259984-Trump-Intelligence-Allegations`.
|
|
37
|
+
|
|
38
|
+
```svelte
|
|
39
|
+
<script>
|
|
40
|
+
import { DocumentCloud } from '@reuters-graphics/graphics-components';
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<DocumentCloud
|
|
44
|
+
slug="3259984-Trump-Intelligence-Allegations"
|
|
45
|
+
altText="These Reports Allege Trump Has Deep Ties To Russia"
|
|
46
|
+
/>
|
|
47
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# EmbedPreviewerLink
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Utilities/EmbedPreviewerLink
|
|
4
|
+
|
|
5
|
+
**Import:** `import { EmbedPreviewerLink } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `dev` | `boolean` | `false` | | — |
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
### Demo
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<EmbedPreviewerLink dev={true} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
# EmbedPreviewerLink
|
|
24
|
+
|
|
25
|
+
The `EmbedPreviewerLink` component is a tool for previewing the embeds in development. It adds an icon at the bottom of the page that, when clicked, opens a previewer with the embeds.
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<script>
|
|
29
|
+
import { EmbedPreviewerLink } from '@reuters-graphics/graphics-components';
|
|
30
|
+
|
|
31
|
+
import { dev } from '$app/environment';
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<EmbedPreviewerLink {dev} />
|
|
35
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# EndNotes
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Text elements/EndNotes
|
|
4
|
+
|
|
5
|
+
**Import:** `import { EndNotes } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `notes` | `EndNote[]` | — | ✓ | An array of endnote items. |
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
### Demo
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<EndNotes notes={/* array — see Props/Types for full type */} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
# EndNotes
|
|
24
|
+
|
|
25
|
+
The `EndNotes` component adds notes such as sources, clarifiying notes and minor corrections that come at the end of a story.
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<script>
|
|
29
|
+
import { EndNotes } from '@reuters-graphics/graphics-components';
|
|
30
|
+
|
|
31
|
+
const notes = [
|
|
32
|
+
{
|
|
33
|
+
title: 'Note',
|
|
34
|
+
text: 'Data is current as of today.',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: 'Sources',
|
|
38
|
+
text: 'Data, Inc.',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
title: 'Edited by',
|
|
42
|
+
text: '<a href="https://www.reuters.com/graphics/">Editor</a>, Copyeditor',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<EndNotes {notes} />
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Using with ArchieML docs
|
|
51
|
+
|
|
52
|
+
With the graphics kit, you'll likely get your text value from an ArchieML doc...
|
|
53
|
+
|
|
54
|
+
```yaml
|
|
55
|
+
# ArchieML doc
|
|
56
|
+
[endNotes]
|
|
57
|
+
title: Note
|
|
58
|
+
text: Data is current as of today
|
|
59
|
+
|
|
60
|
+
title: Sources
|
|
61
|
+
text: Data, Inc.
|
|
62
|
+
|
|
63
|
+
title: Edited by
|
|
64
|
+
text: Editor, Copyeditor
|
|
65
|
+
[]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
... which you'll pass to the `EndNotes` component.
|
|
69
|
+
|
|
70
|
+
```svelte
|
|
71
|
+
<!-- graphics kit -->
|
|
72
|
+
<script>
|
|
73
|
+
import { EndNotes } from '@reuters-graphics/graphics-components';
|
|
74
|
+
|
|
75
|
+
import content from '$locales/en/content.json';
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<EndNotes notes={content.endNotes} />
|
|
79
|
+
```
|