@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,515 @@
|
|
|
1
|
+
# HeroHeadline
|
|
2
|
+
|
|
3
|
+
**Category:** Components/Text elements/HeroHeadline
|
|
4
|
+
|
|
5
|
+
**Import:** `import { HeroHeadline } from '@reuters-graphics/graphics-components'`
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Required | Description |
|
|
10
|
+
|------|------|---------|:--------:|-------------|
|
|
11
|
+
| `hed` | `string \| Snippet` | β | β | Headline, parsed as an _inline_ markdown string in an `h1` element OR as a custom snippet. |
|
|
12
|
+
| `children` | `Snippet` | β | | Optional snippet for a custom hero graphic, photo, etc. |
|
|
13
|
+
| `stacked` | `boolean` | `true` | | Set to `false` for inline hero media |
|
|
14
|
+
| `img` | `string` | β | | Path to the background hero image |
|
|
15
|
+
| `ariaDescription` | `string` | β | | ARIA description, passed in as a markdown string. |
|
|
16
|
+
| `notes` | `string` | β | | Notes to the graphic, passed in as a markdown string. |
|
|
17
|
+
| `class` | `string` | `''` | | Add classes to the block tag to target it with custom CSS. |
|
|
18
|
+
| `hedSize` | `HeadlineSize` | `'normal'` | | Headline size: small, normal, big, bigger, biggest Options: `small`, `normal`, `big`, `bigger`, `biggest` |
|
|
19
|
+
| `hedAlign` | `'left' \| 'center' \| 'right'` | `'center'` | | Headline horizontal alignment: left, center, right Options: `left`, `center`, `right` |
|
|
20
|
+
| `hedWidth` | `'normal' \| 'wide' \| 'wider' \| 'widest'` | `'normal'` | | Width of the headline: normal, wide, wider, widest Options: `normal`, `wide`, `wider`, `widest` |
|
|
21
|
+
| `dek` | `string \| Snippet` | β | | Dek, parsed as a markdown string OR as a custom snippet. |
|
|
22
|
+
| `section` | `string` | β | | Section title |
|
|
23
|
+
| `authors` | `string[]` | `[]` | | Array of author names, which will be slugified to create links to Reuters author pages |
|
|
24
|
+
| `publishTime` | `string` | β | β | Publish time as a datetime string. |
|
|
25
|
+
| `updateTime` | `string` | β | | Update time as a datetime string. |
|
|
26
|
+
| `width` | `'normal' \| 'wide' \| 'wider' \| 'widest'` | `'widest'` | | Width of the hero graphic: normal, wide, wider, widest Options: `normal`, `wide`, `wider`, `widest` |
|
|
27
|
+
| `embedded` | `boolean` | `false` | | Set to true for embeds. |
|
|
28
|
+
| `getAuthorPage` | `(author: string) => string` | β | | Custom function that returns an author page URL. |
|
|
29
|
+
| `byline` | `Snippet` | β | | Optional snippet for a custom byline. |
|
|
30
|
+
| `published` | `Snippet` | β | | Optional snippet for a custom published dateline. |
|
|
31
|
+
| `updated` | `Snippet` | β | | Optional snippet for a custom updated dateline. |
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Photo hero
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<Block width="fluid" class="chromatic-ignore">
|
|
39
|
+
<SiteHeader />
|
|
40
|
+
</Block>
|
|
41
|
+
<HeroHeadline
|
|
42
|
+
section="World News"
|
|
43
|
+
hed="Reuters Graphics Interactive"
|
|
44
|
+
dek="The beginning of a beautiful page"
|
|
45
|
+
authors={['Jane Doe', 'John Doe']}
|
|
46
|
+
publishTime={new Date('2022-03-04').toISOString()}
|
|
47
|
+
img={polarImgSrc}
|
|
48
|
+
notes="Photo by REUTERS"
|
|
49
|
+
ariaDescription="A photo of a polar bear"
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Transparent header
|
|
54
|
+
|
|
55
|
+
```svelte
|
|
56
|
+
<div class="transparent-header">
|
|
57
|
+
<Block width="fluid" class="chromatic-ignore">
|
|
58
|
+
<SiteHeader />
|
|
59
|
+
</Block>
|
|
60
|
+
<HeroHeadline
|
|
61
|
+
section="World News"
|
|
62
|
+
hed="Reuters Graphics Interactive"
|
|
63
|
+
dek="The beginning of a beautiful page"
|
|
64
|
+
authors={['Jane Doe', 'John Doe']}
|
|
65
|
+
publishTime={new Date('2022-03-04').toISOString()}
|
|
66
|
+
img={polarImgSrc}
|
|
67
|
+
ariaDescription="A photo of a polar bear"
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Ai2svelte hero
|
|
73
|
+
|
|
74
|
+
```svelte
|
|
75
|
+
<Block width="fluid" class="chromatic-ignore">
|
|
76
|
+
<SiteHeader />
|
|
77
|
+
</Block>
|
|
78
|
+
|
|
79
|
+
<HeroHeadline
|
|
80
|
+
hed={'Earthquake devastates Afghanistan'}
|
|
81
|
+
hedSize={'big'}
|
|
82
|
+
hedWidth="wide"
|
|
83
|
+
class="custom-hero mb-0"
|
|
84
|
+
authors={[
|
|
85
|
+
'Anand Katakam',
|
|
86
|
+
'Vijdan Mohammad Kawoosa',
|
|
87
|
+
'Adolfo Arranz',
|
|
88
|
+
'Wen Foo',
|
|
89
|
+
'Simon Scarr',
|
|
90
|
+
'Aman Bhargava',
|
|
91
|
+
'Jitesh Chowdhury',
|
|
92
|
+
'Manas Sharma',
|
|
93
|
+
'Aditi Bhandari',
|
|
94
|
+
]}
|
|
95
|
+
publishTime={new Date('2022-06-24').toISOString()}
|
|
96
|
+
>
|
|
97
|
+
<GraphicBlock
|
|
98
|
+
width="widest"
|
|
99
|
+
role="figure"
|
|
100
|
+
class="my-0"
|
|
101
|
+
ariaDescription="Earthquake impact map"
|
|
102
|
+
>
|
|
103
|
+
<QuakeMap />
|
|
104
|
+
</GraphicBlock>
|
|
105
|
+
</HeroHeadline>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Video hero
|
|
109
|
+
|
|
110
|
+
```svelte
|
|
111
|
+
<Block width="fluid" class="chromatic-ignore">
|
|
112
|
+
<SiteHeader />
|
|
113
|
+
</Block>
|
|
114
|
+
|
|
115
|
+
<HeroHeadline
|
|
116
|
+
class="video-hero"
|
|
117
|
+
hed="The conflict in Ethiopia"
|
|
118
|
+
hedSize="bigger"
|
|
119
|
+
hedWidth="wide"
|
|
120
|
+
authors={['Aditi Bhandari ', 'David Lewis']}
|
|
121
|
+
publishTime={new Date('2020-12-18').toISOString()}
|
|
122
|
+
>
|
|
123
|
+
<Video
|
|
124
|
+
width="widest"
|
|
125
|
+
class="my-0"
|
|
126
|
+
showControls={false}
|
|
127
|
+
preloadVideo="auto"
|
|
128
|
+
playVideoWhenInView={false}
|
|
129
|
+
src="https://vm.reuters.tv/9c72e/titlef2ac(425954_R21MP41500).mp4"
|
|
130
|
+
poster="https://www.reuters.com/resizer/vexYmtEuXKmfnsCbfS6jSMVbHms=/1080x0/filters:quality(80)/cloudfront-us-east-2.images.arcpublishing.com/reuters/VKJHKJEENVO4DASDND3VLHPV5Y.jpg"
|
|
131
|
+
notes="Drone footage from the Village 8 refugee camp in Sudan."
|
|
132
|
+
ariaDescription="Aerial footage of people houses in refugee camp"
|
|
133
|
+
/>
|
|
134
|
+
</HeroHeadline>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Inline hero
|
|
138
|
+
|
|
139
|
+
```svelte
|
|
140
|
+
<Block width="fluid" class="chromatic-ignore">
|
|
141
|
+
<SiteHeader />
|
|
142
|
+
</Block>
|
|
143
|
+
|
|
144
|
+
<!-- Set `stacked` to `false` -->
|
|
145
|
+
<HeroHeadline
|
|
146
|
+
stacked={false}
|
|
147
|
+
section="Global news"
|
|
148
|
+
hed="The plunge from 29,000 feet"
|
|
149
|
+
dek="How China Eastern Airlines flight MU5735 went from an uneventful flight at cruising altitude to disaster in just minutes."
|
|
150
|
+
class="mb-0"
|
|
151
|
+
authors={['Simon Scarr', 'Vijdan Mohammad Kawoosa']}
|
|
152
|
+
publishTime={new Date('2020-01-01').toISOString()}
|
|
153
|
+
>
|
|
154
|
+
<GraphicBlock
|
|
155
|
+
width="widest"
|
|
156
|
+
role="figure"
|
|
157
|
+
class="my-0"
|
|
158
|
+
ariaDescription="Earthquake impact map"
|
|
159
|
+
notes="Source: Satellite image from Google, Maxar Technologies, CNES/Airbus, Landsat/Copernicus"
|
|
160
|
+
>
|
|
161
|
+
<CrashMap />
|
|
162
|
+
</GraphicBlock>
|
|
163
|
+
</HeroHeadline>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Custom hed
|
|
167
|
+
|
|
168
|
+
```svelte
|
|
169
|
+
<HeroHeadline
|
|
170
|
+
class="custom-hed"
|
|
171
|
+
authors={[
|
|
172
|
+
'Prasanta Kumar Dutta',
|
|
173
|
+
'Dea Bankova',
|
|
174
|
+
'Aditi Bhandari',
|
|
175
|
+
'Anurag Rao',
|
|
176
|
+
]}
|
|
177
|
+
publishTime={new Date('2023-05-11').toISOString()}
|
|
178
|
+
img={eurovisImgSrc}
|
|
179
|
+
getAuthorPage={(author: string) => {
|
|
180
|
+
return `mailto:${author.replace(' ', '')}@example.com`;
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
{#snippet hed()}
|
|
184
|
+
<h1>
|
|
185
|
+
<div class="body-note">A visual guide to</div>
|
|
186
|
+
<div class="title text-6xl font-light tracking-widest">EUROVISION</div>
|
|
187
|
+
</h1>
|
|
188
|
+
{/snippet}
|
|
189
|
+
|
|
190
|
+
{#snippet dek()}
|
|
191
|
+
<div class="dek">
|
|
192
|
+
<p>
|
|
193
|
+
Performers from 37 countries are coming together May 9-13 in
|
|
194
|
+
Liverpool, England, for the 67th annual Eurovision Song Contest. The
|
|
195
|
+
winner gets the trophy and their country gets the right to host next
|
|
196
|
+
yearβs event, produced by the European Broadcasting Union (EBU).
|
|
197
|
+
</p>
|
|
198
|
+
</div>
|
|
199
|
+
{/snippet}
|
|
200
|
+
</HeroHeadline>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Documentation
|
|
204
|
+
|
|
205
|
+
# HeroHeadline
|
|
206
|
+
|
|
207
|
+
The `HeroHeadline` component creates a Reuters Graphics headline with a hero media, which can be a graphic, photo, video or other media.
|
|
208
|
+
|
|
209
|
+
By default, the hero is in the background, i.e., the headline and dek are stacked on top of the hero. You can unstack and insert the hero media inline -- i.e., before or after the headline -- by setting `stacked: false`. [Read more.](?/iframe.html?viewMode=docs\&id=components-text-elements-heroheadline--docs\&globals=\&args=#inline-hero)
|
|
210
|
+
|
|
211
|
+
## Photo hero
|
|
212
|
+
|
|
213
|
+
To use a photo as the hero, simply pass the image source to the `img` prop.
|
|
214
|
+
|
|
215
|
+
```svelte
|
|
216
|
+
<!-- App.svelte -->
|
|
217
|
+
<script>
|
|
218
|
+
import { HeroHeadline } from '@reuters-graphics/graphics-components';
|
|
219
|
+
import { asset } from '$app/paths'; // π If using in the graphics kit...
|
|
220
|
+
|
|
221
|
+
let { embedded = false } = $props(); // π If using in the graphics kit...
|
|
222
|
+
</script>
|
|
223
|
+
|
|
224
|
+
<HeroHeadline
|
|
225
|
+
{embedded}
|
|
226
|
+
img={asset('/images/polar-bear.jpg')}
|
|
227
|
+
ariaDescription="A photo of a polar bear"
|
|
228
|
+
notes="Photo by REUTERS"
|
|
229
|
+
section={'World News'}
|
|
230
|
+
hed={'Reuters Graphics Interactive'}
|
|
231
|
+
dek={'The beginning of a beautiful page'}
|
|
232
|
+
authors={['Jane Doe', 'John Doe']}
|
|
233
|
+
/>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Transparent site header
|
|
237
|
+
|
|
238
|
+
In the graphics kit, set styles in `global.scss` to make the Reuters site header transparent and make the hero go all the way to the top of the page:
|
|
239
|
+
|
|
240
|
+
```scss
|
|
241
|
+
// global.scss
|
|
242
|
+
.nav-container {
|
|
243
|
+
background-color: transparent !important;
|
|
244
|
+
}
|
|
245
|
+
.nav-container .inner {
|
|
246
|
+
background-color: transparent !important;
|
|
247
|
+
border: none !important;
|
|
248
|
+
}
|
|
249
|
+
.hero-wrapper {
|
|
250
|
+
margin-block-start: -64px;
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Ai2svelte hero
|
|
255
|
+
|
|
256
|
+
To use an ai2svelte graphic as the hero, wrap your ai2svelte component in a `GraphicBlock` component and insert it inside `HeroHeadline`.
|
|
257
|
+
|
|
258
|
+
To customise styles, use CSS to target the class passed to `HeroHeadline`.
|
|
259
|
+
|
|
260
|
+
> **Note:** Pass `notes` and `ariaDescription` to the `GraphicBlock` component to provide additional information about the ai2svelte graphic.
|
|
261
|
+
|
|
262
|
+
```svelte
|
|
263
|
+
<!-- App.svelte -->
|
|
264
|
+
<script>
|
|
265
|
+
import {
|
|
266
|
+
HeroHeadline,
|
|
267
|
+
GraphicBlock,
|
|
268
|
+
} from '@reuters-graphics/graphics-components';
|
|
269
|
+
|
|
270
|
+
import QuakeMap from './ai2svelte/graphic.svelte'; // Your ai2svelte component
|
|
271
|
+
|
|
272
|
+
import { asset } from '$app/paths'; // π If using in the graphics kit...
|
|
273
|
+
|
|
274
|
+
let { embedded = false } = $props(); // π If using in the graphics kit...
|
|
275
|
+
</script>
|
|
276
|
+
|
|
277
|
+
<HeroHeadline
|
|
278
|
+
{embedded}
|
|
279
|
+
hed="Earthquake devastates Afghanistan"
|
|
280
|
+
hedSize="big"
|
|
281
|
+
hedWidth="wide"
|
|
282
|
+
class="custom-hero mb-0"
|
|
283
|
+
authors={[
|
|
284
|
+
'Anand Katakam',
|
|
285
|
+
'Vijdan Mohammad Kawoosa',
|
|
286
|
+
'Adolfo Arranz',
|
|
287
|
+
'Wen Foo',
|
|
288
|
+
'Simon Scarr',
|
|
289
|
+
'Aman Bhargava',
|
|
290
|
+
'Jitesh Chowdhury',
|
|
291
|
+
'Manas Sharma',
|
|
292
|
+
'Aditi Bhandari',
|
|
293
|
+
]}
|
|
294
|
+
publishTime={new Date('2022-06-24').toISOString()}
|
|
295
|
+
>
|
|
296
|
+
<GraphicBlock
|
|
297
|
+
width="widest"
|
|
298
|
+
role="figure"
|
|
299
|
+
class="my-0"
|
|
300
|
+
ariaDescription="Earthquake impact map"
|
|
301
|
+
>
|
|
302
|
+
<!-- Pass `assetsPath` if in graphics kit -->
|
|
303
|
+
<QuakeMap assetsPath={asset('/').replace(/\/$/, '')} />
|
|
304
|
+
</GraphicBlock>
|
|
305
|
+
</HeroHeadline>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Add styles in `global.scss`:
|
|
309
|
+
|
|
310
|
+
```scss
|
|
311
|
+
// global.scss
|
|
312
|
+
// Customise styles using the class (e.g. `custom-hero` here) passed to `HeroHeadline`
|
|
313
|
+
.hero-wrapper {
|
|
314
|
+
.custom-hero.headline {
|
|
315
|
+
// Adjust vertical positioning
|
|
316
|
+
align-items: flex-end !important;
|
|
317
|
+
|
|
318
|
+
@media (max-width: 1100px) {
|
|
319
|
+
// Adjust line length of title
|
|
320
|
+
max-width: var(--normal-column-width) !important;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Make hero shorter than 100vh
|
|
325
|
+
--heroHeight: 85svh;
|
|
326
|
+
|
|
327
|
+
@media (max-width: 960px) {
|
|
328
|
+
--heroHeight: 65svh;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// For small height
|
|
332
|
+
@media (max-height: 850px) {
|
|
333
|
+
--heroHeight: 100svh;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Custom hero sizing for landscape mobile
|
|
337
|
+
@media (max-width: 960px) and (orientation: landscape) {
|
|
338
|
+
--heroHeight: 200svh;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Override default fixed height for hero layout in embeds
|
|
343
|
+
.hero-wrapper.embedded {
|
|
344
|
+
--heroHeight: 1000px;
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Video hero
|
|
349
|
+
|
|
350
|
+
To add a video as the hero, use the [Video](?path=/docs/components-multimedia-video--docs) component. To customise styles, use CSS to target the class passed to `HeroHeadline`.
|
|
351
|
+
|
|
352
|
+
> **Note:** Pass `notes` and `ariaDescription` to the `GraphicBlock` component to provide additional information about the video.
|
|
353
|
+
|
|
354
|
+
```svelte
|
|
355
|
+
<script>
|
|
356
|
+
import { HeroHeadline, Video } from '@reuters-graphics/graphics-components';
|
|
357
|
+
import { asset } from '$app/paths'; // π If using in the graphics kit...
|
|
358
|
+
|
|
359
|
+
let { embedded = false } = $props(); // π If using in the graphics kit...
|
|
360
|
+
</script>
|
|
361
|
+
|
|
362
|
+
<HeroHeadline
|
|
363
|
+
{embedded}
|
|
364
|
+
class="video-hero"
|
|
365
|
+
hed="The conflict in Ethiopia"
|
|
366
|
+
hedSize="bigger"
|
|
367
|
+
hedWidth="wide"
|
|
368
|
+
authors={['Aditi Bhandari ', 'David Lewis']}
|
|
369
|
+
publishTime={new Date('2020-12-18').toISOString()}
|
|
370
|
+
>
|
|
371
|
+
<Video
|
|
372
|
+
width="widest"
|
|
373
|
+
class="my-0"
|
|
374
|
+
showControls={false}
|
|
375
|
+
preloadVideo="auto"
|
|
376
|
+
playVideoWhenInView={false}
|
|
377
|
+
src={asset('/videos/intro.mp4')}
|
|
378
|
+
poster={asset('/images/video-poster-intro.jpg')}
|
|
379
|
+
notes="Drone footage from the Village 8 refugee camp in Sudan."
|
|
380
|
+
ariaDescription="Aerial footage of people houses in refugee camp"
|
|
381
|
+
/>
|
|
382
|
+
</HeroHeadline>
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Add styles in `global.scss`:
|
|
386
|
+
|
|
387
|
+
```scss
|
|
388
|
+
// global.scss
|
|
389
|
+
// Customise styles using the class (e.g. `video-hero` here) passed to `HeroHeadline`
|
|
390
|
+
.hero-wrapper {
|
|
391
|
+
--heroHeight: calc(100svh - 60px);
|
|
392
|
+
.video-hero.headline {
|
|
393
|
+
header {
|
|
394
|
+
// Adjust vertical position as offset from default center
|
|
395
|
+
top: calc(50svh - 250px);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
h1 {
|
|
399
|
+
color: #ffd430;
|
|
400
|
+
text-shadow: 3px 4px 7px rgba(81, 67, 21, 0.8);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
## Inline hero
|
|
407
|
+
|
|
408
|
+
To use a photo, graphic, video, etc. as an inline hero -- i.e., to make the hero appear _after_ the headline and dek, instead of stacked underneath -- set `stacked` to `false`. Otherwise, add your hero media in the same way as documented above.
|
|
409
|
+
|
|
410
|
+
```svelte
|
|
411
|
+
<!-- App.svelte -->
|
|
412
|
+
<script>
|
|
413
|
+
import {
|
|
414
|
+
HeroHeadline,
|
|
415
|
+
GraphicBlock,
|
|
416
|
+
} from '@reuters-graphics/graphics-components';
|
|
417
|
+
import { asset } from '$app/paths'; // π If using in the graphics kit...
|
|
418
|
+
|
|
419
|
+
let { embedded = false } = $props(); // π If using in the graphics kit...
|
|
420
|
+
</script>
|
|
421
|
+
|
|
422
|
+
<!-- Set `stacked` to `false` -->
|
|
423
|
+
<HeroHeadline
|
|
424
|
+
{embedded}
|
|
425
|
+
stacked={false}
|
|
426
|
+
section="Global news"
|
|
427
|
+
hed="The plunge from 29,000 feet"
|
|
428
|
+
dek="How China Eastern Airlines flight MU5735 went from an uneventful flight at cruising altitude to disaster in just minutes."
|
|
429
|
+
class="mb-0"
|
|
430
|
+
authors={['Simon Scarr', 'Vijdan Mohammad Kawoosa']}
|
|
431
|
+
publishTime={new Date('2020-01-01').toISOString()}
|
|
432
|
+
>
|
|
433
|
+
<GraphicBlock
|
|
434
|
+
width="widest"
|
|
435
|
+
role="figure"
|
|
436
|
+
class="my-0"
|
|
437
|
+
ariaDescription="Earthquake impact map"
|
|
438
|
+
notes="Source: Satellite image from Google, Maxar Technologies, CNES/Airbus, Landsat/Copernicus"
|
|
439
|
+
>
|
|
440
|
+
<!-- Pass `assetsPath` if in graphics kit -->
|
|
441
|
+
<CrashMap assetsPath={asset('/').replace(/\/$/, '')} />
|
|
442
|
+
</GraphicBlock>
|
|
443
|
+
</HeroHeadline>
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
## Custom hed, dek and byline
|
|
447
|
+
|
|
448
|
+
The `HeroHeadline` component internally uses the [Headline](?path=/docs/components-text-elements-headline--docs) component to render the headline and dek, which lets you to customise the headline and dek by passing [snippets](https://svelte.dev/docs/svelte/snippet) into the `hed` and `dek` props.
|
|
449
|
+
|
|
450
|
+
Since `Headline` internally uses the [Byline](?path=/docs/components-text-elements-headline--docs) component, you can also customise the author page hyperlink and bylines with the `getAuthorPage`, `byline`, `published` and `updated` props.
|
|
451
|
+
|
|
452
|
+
```svelte
|
|
453
|
+
<!-- App.svelte -->
|
|
454
|
+
<HeroHeadline
|
|
455
|
+
class="custom-hed"
|
|
456
|
+
authors={[
|
|
457
|
+
'Prasanta Kumar Dutta',
|
|
458
|
+
'Dea Bankova',
|
|
459
|
+
'Aditi Bhandari',
|
|
460
|
+
'Anurag Rao',
|
|
461
|
+
]}
|
|
462
|
+
publishTime={new Date('2023-05-11').toISOString()}
|
|
463
|
+
img={eurovisImgSrc}
|
|
464
|
+
getAuthorPage={(author) => {
|
|
465
|
+
return `mailto:${author.replace(' ', '')}@example.com`;
|
|
466
|
+
}}
|
|
467
|
+
>
|
|
468
|
+
<!-- Custom hed snippet -->
|
|
469
|
+
{#snippet hed()}
|
|
470
|
+
<h1>
|
|
471
|
+
<div class="body-note">A visual guide to</div>
|
|
472
|
+
<div class="title text-6xl font-light tracking-widest">EUROVISION</div>
|
|
473
|
+
</h1>
|
|
474
|
+
{/snippet}
|
|
475
|
+
|
|
476
|
+
<!-- Custom dek snippet -->
|
|
477
|
+
{#snippet dek()}
|
|
478
|
+
<div class="dek">
|
|
479
|
+
<p>
|
|
480
|
+
Performers from 37 countries are coming together May 9-13 in Liverpool,
|
|
481
|
+
England, for the 67th annual Eurovision Song Contest. The winner gets
|
|
482
|
+
the trophy and their country gets the right to host next yearβs event,
|
|
483
|
+
produced by the European Broadcasting Union (EBU).
|
|
484
|
+
</p>
|
|
485
|
+
</div>
|
|
486
|
+
{/snippet}
|
|
487
|
+
</HeroHeadline>
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
Add styles in `global.scss`:
|
|
491
|
+
|
|
492
|
+
```scss
|
|
493
|
+
// global.scss
|
|
494
|
+
.custom-hed {
|
|
495
|
+
h1 {
|
|
496
|
+
.body-note {
|
|
497
|
+
color: #ffffff;
|
|
498
|
+
}
|
|
499
|
+
.title {
|
|
500
|
+
color: #ffffff;
|
|
501
|
+
text-shadow: 1px 1px 8px #ff7c88;
|
|
502
|
+
filter: drop-shadow(0px 0px 12px #ff7c88);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.dek {
|
|
507
|
+
margin-block-start: 1rem;
|
|
508
|
+
p {
|
|
509
|
+
color: #ffffff;
|
|
510
|
+
text-shadow: 1px 1px 8px #ff7c88;
|
|
511
|
+
filter: drop-shadow(0px 0px 12px #ff7c88);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
```
|