@reuters-graphics/graphics-components 3.0.5 → 3.0.6
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/Headpile/Headpile.mdx +37 -0
- package/dist/components/Headpile/Headpile.stories.svelte +37 -0
- package/dist/components/Headpile/Headpile.stories.svelte.d.ts +19 -0
- package/dist/components/Headpile/Headpile.svelte +84 -0
- package/dist/components/Headpile/Headpile.svelte.d.ts +53 -0
- package/dist/components/Headpile/Headshot.svelte +41 -0
- package/dist/components/Headpile/Headshot.svelte.d.ts +6 -0
- package/dist/components/Headpile/KeyFigure.svelte +110 -0
- package/dist/components/Headpile/KeyFigure.svelte.d.ts +10 -0
- package/dist/components/Headpile/images/abdel.png +0 -0
- package/dist/components/Headpile/images/hemedti.png +0 -0
- package/dist/components/ScrollerBase/ScrollerBase.svelte +1 -1
- package/dist/components/ScrollerBase/demo/ScrollerDemo.svelte +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Meta, Canvas } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as HeadpileStories from './Headpile.stories.svelte';
|
|
4
|
+
|
|
5
|
+
<Meta of={HeadpileStories} />
|
|
6
|
+
|
|
7
|
+
# Headpile
|
|
8
|
+
|
|
9
|
+
The `Headpile` component is a headshot-bulleted list of people, identifying them with their names, roles and a short description of their significance to a story.
|
|
10
|
+
|
|
11
|
+
It's designed to be used with headshots that have had their background removed, which can be done in the [Preview app](https://support.apple.com/en-gb/guide/preview/prvw15636/mac?#apd320b3b1b750a4) on macOS.
|
|
12
|
+
|
|
13
|
+
```svelte
|
|
14
|
+
<script>
|
|
15
|
+
import { Headpile } from '@reuters-graphics/graphics-components';
|
|
16
|
+
import { assets } from '$app/paths'; // 👈 If using in the graphics kit...
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Headpile
|
|
20
|
+
figures={[
|
|
21
|
+
{
|
|
22
|
+
img: `${assets}/images/person-A.jpg`,
|
|
23
|
+
name: 'General Abdel Fattah al-Burhan',
|
|
24
|
+
role: "Sudan's Sovereign Council Chief and military commander",
|
|
25
|
+
text: 'Burhan was little known in public life until taking part in the coup ...',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
img: `${assets}/images/person-B.jpg`,
|
|
29
|
+
name: 'General Mohamed Hamdan Dagalo',
|
|
30
|
+
role: 'Leader of the Sudanese paramilitary Rapid Support Forces (RSF)',
|
|
31
|
+
text: 'Popularly known as Hemedti, Dagalo rose from lowly beginnings ...',
|
|
32
|
+
},
|
|
33
|
+
]}
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<Canvas of={HeadpileStories.Demo} />
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Headpile from './Headpile.svelte';
|
|
4
|
+
|
|
5
|
+
import hed1 from './images/abdel.png';
|
|
6
|
+
import hed2 from './images/hemedti.png';
|
|
7
|
+
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'Components/Text elements/Headpile',
|
|
10
|
+
component: Headpile,
|
|
11
|
+
argTypes: {},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const defaultArgs = [
|
|
15
|
+
{
|
|
16
|
+
name: 'General Abdel Fattah al-Burhan',
|
|
17
|
+
role: "Sudan's Sovereign Council Chief and military commander",
|
|
18
|
+
img: hed1,
|
|
19
|
+
text: 'Burhan was little known in public life until taking part in the coup against Bashir in 2019 after a popular uprising against his rule. In August 2019, his role as de facto head of state was affirmed when he became head of the Sovereign Council, a body comprising civilian and military leaders formed to oversee the transition towards elections.',
|
|
20
|
+
// colour: '#957caa',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'General Mohamed Hamdan Dagalo',
|
|
24
|
+
role: 'Leader of the Sudanese paramilitary Rapid Support Forces (RSF)',
|
|
25
|
+
img: hed2,
|
|
26
|
+
text: "Popularly known as Hemedti, Dagalo rose from lowly beginnings as a camel trader to head a widely feared Arab militia that crushed a revolt in Darfur, winning him influence and eventually a role as Sudan's former deputy head of state.\r\n\r\nOver the past decade, he has been a key figure in Sudanese politics, aiding in the ousting of Bashir in 2019 and suppressing pro-democracy protests. As the country limped from one economic crisis to another, Hemedti became one of Sudan’s richest men, exporting gold from mines in Darfur seized by his fighters.",
|
|
27
|
+
colour: '#afb776',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<Story
|
|
33
|
+
name="Demo"
|
|
34
|
+
args={{
|
|
35
|
+
figures: defaultArgs,
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Headpile from './Headpile.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Headpile: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Headpile = InstanceType<typeof Headpile>;
|
|
19
|
+
export default Headpile;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ContainerWidth } from '../@types/global';
|
|
3
|
+
import Block from '../Block/Block.svelte';
|
|
4
|
+
import KeyFigure from './KeyFigure.svelte';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
/**
|
|
8
|
+
* Add classes to target with custom CSS.
|
|
9
|
+
*/
|
|
10
|
+
class: string;
|
|
11
|
+
/**
|
|
12
|
+
* Add an id to target with custom CSS.
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* Width of the container.
|
|
17
|
+
*/
|
|
18
|
+
width: Extract<ContainerWidth, 'normal' | 'wide'>;
|
|
19
|
+
/**
|
|
20
|
+
* Default background colour to be used as a mount behind the headshot.
|
|
21
|
+
*/
|
|
22
|
+
colour: string;
|
|
23
|
+
/**
|
|
24
|
+
* Individual figures -- i.e., people -- for the headpile.
|
|
25
|
+
*/
|
|
26
|
+
figures: {
|
|
27
|
+
/**
|
|
28
|
+
* Headshot image src. Be sure to prefix the image
|
|
29
|
+
*
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { assets } from '$app/paths';
|
|
32
|
+
*
|
|
33
|
+
* const imgSrc = `${assets}/images/my-image.jpg`;
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
img: string;
|
|
37
|
+
/**
|
|
38
|
+
* Figure name.
|
|
39
|
+
*/
|
|
40
|
+
name: string;
|
|
41
|
+
/**
|
|
42
|
+
* Figure role or title.
|
|
43
|
+
*/
|
|
44
|
+
role?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Text describing the person.
|
|
47
|
+
*/
|
|
48
|
+
text: string;
|
|
49
|
+
/**
|
|
50
|
+
* Background colour to be used as a mount behind the headshot.
|
|
51
|
+
*/
|
|
52
|
+
colour?: string;
|
|
53
|
+
}[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let {
|
|
57
|
+
figures,
|
|
58
|
+
class: cls,
|
|
59
|
+
id,
|
|
60
|
+
width = 'normal',
|
|
61
|
+
colour = '#cccccc',
|
|
62
|
+
}: Props = $props();
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<Block class="fmy-6 {cls} {id} {width}">
|
|
66
|
+
<div class="figures">
|
|
67
|
+
{#each figures as figure}
|
|
68
|
+
<KeyFigure {...{ ...figure, colour: figure.colour ?? colour }} />
|
|
69
|
+
{/each}
|
|
70
|
+
</div>
|
|
71
|
+
</Block>
|
|
72
|
+
|
|
73
|
+
<style>/* Generated from
|
|
74
|
+
https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12
|
|
75
|
+
*/
|
|
76
|
+
/* Generated from
|
|
77
|
+
https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12
|
|
78
|
+
*/
|
|
79
|
+
/* Scales by 1.125 */
|
|
80
|
+
div.figures {
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
gap: 2.75rem;
|
|
84
|
+
}</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ContainerWidth } from '../@types/global';
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* Add classes to target with custom CSS.
|
|
5
|
+
*/
|
|
6
|
+
class: string;
|
|
7
|
+
/**
|
|
8
|
+
* Add an id to target with custom CSS.
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* Width of the container.
|
|
13
|
+
*/
|
|
14
|
+
width: Extract<ContainerWidth, 'normal' | 'wide'>;
|
|
15
|
+
/**
|
|
16
|
+
* Default background colour to be used as a mount behind the headshot.
|
|
17
|
+
*/
|
|
18
|
+
colour: string;
|
|
19
|
+
/**
|
|
20
|
+
* Individual figures -- i.e., people -- for the headpile.
|
|
21
|
+
*/
|
|
22
|
+
figures: {
|
|
23
|
+
/**
|
|
24
|
+
* Headshot image src. Be sure to prefix the image
|
|
25
|
+
*
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { assets } from '$app/paths';
|
|
28
|
+
*
|
|
29
|
+
* const imgSrc = `${assets}/images/my-image.jpg`;
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
img: string;
|
|
33
|
+
/**
|
|
34
|
+
* Figure name.
|
|
35
|
+
*/
|
|
36
|
+
name: string;
|
|
37
|
+
/**
|
|
38
|
+
* Figure role or title.
|
|
39
|
+
*/
|
|
40
|
+
role?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Text describing the person.
|
|
43
|
+
*/
|
|
44
|
+
text: string;
|
|
45
|
+
/**
|
|
46
|
+
* Background colour to be used as a mount behind the headshot.
|
|
47
|
+
*/
|
|
48
|
+
colour?: string;
|
|
49
|
+
}[];
|
|
50
|
+
}
|
|
51
|
+
declare const Headpile: import("svelte").Component<Props, {}, "">;
|
|
52
|
+
type Headpile = ReturnType<typeof Headpile>;
|
|
53
|
+
export default Headpile;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { img = '', colour = 'var(--theme-colour-accent)' } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="headshot-wrapper">
|
|
6
|
+
<div class="background" style="background-color: {colour};"></div>
|
|
7
|
+
<div class="headshot" style="background-image: url({img}); "></div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<style>.headshot-wrapper {
|
|
11
|
+
width: 7rem;
|
|
12
|
+
height: 6.75rem;
|
|
13
|
+
position: relative;
|
|
14
|
+
margin-block-start: -1.75rem;
|
|
15
|
+
margin-block-end: -1.75rem;
|
|
16
|
+
border-radius: 0.25rem;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.background {
|
|
21
|
+
position: absolute;
|
|
22
|
+
inset-block-end: 0;
|
|
23
|
+
inset-inline-start: 0;
|
|
24
|
+
width: 7rem;
|
|
25
|
+
height: 4.75rem;
|
|
26
|
+
display: inline-block;
|
|
27
|
+
border-radius: 0.25rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.headshot {
|
|
31
|
+
display: inline-block;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
background-size: 106%;
|
|
35
|
+
background-position: center bottom;
|
|
36
|
+
background-repeat: no-repeat;
|
|
37
|
+
position: absolute;
|
|
38
|
+
inset-block-end: 0;
|
|
39
|
+
inset-inline-start: 0;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}</style>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Markdown } from '@reuters-graphics/svelte-markdown';
|
|
3
|
+
import Headshot from './Headshot.svelte';
|
|
4
|
+
import { MediaQuery } from 'svelte/reactivity';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
img: string;
|
|
8
|
+
name: string;
|
|
9
|
+
role?: string;
|
|
10
|
+
text: string;
|
|
11
|
+
colour?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let { name, role, img, text, colour }: Props = $props();
|
|
15
|
+
|
|
16
|
+
const mobile = new MediaQuery('max-width: 600px');
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div>
|
|
20
|
+
<div class="wrapper-profile">
|
|
21
|
+
<div>
|
|
22
|
+
<Headshot {img} {colour} />
|
|
23
|
+
</div>
|
|
24
|
+
<div class="text">
|
|
25
|
+
<div class="title">{name}</div>
|
|
26
|
+
<div class="role">
|
|
27
|
+
{role || ''}
|
|
28
|
+
</div>
|
|
29
|
+
{#if !mobile.current}
|
|
30
|
+
<div class="description desktop">
|
|
31
|
+
<Markdown source={text} />
|
|
32
|
+
</div>
|
|
33
|
+
{/if}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
{#if mobile.current}
|
|
38
|
+
<div class="description mobile">
|
|
39
|
+
<Markdown source={text} />
|
|
40
|
+
</div>
|
|
41
|
+
{/if}
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<style>/* Generated from
|
|
45
|
+
https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12
|
|
46
|
+
*/
|
|
47
|
+
/* Generated from
|
|
48
|
+
https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12
|
|
49
|
+
*/
|
|
50
|
+
/* Scales by 1.125 */
|
|
51
|
+
.wrapper-profile {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: flex-start;
|
|
54
|
+
justify-content: start;
|
|
55
|
+
gap: 1rem;
|
|
56
|
+
width: 100%;
|
|
57
|
+
min-height: 5.5rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.title {
|
|
61
|
+
font-weight: 700;
|
|
62
|
+
font-size: var(--theme-font-size-base);
|
|
63
|
+
line-height: 1;
|
|
64
|
+
}
|
|
65
|
+
@media (max-width: 450px) {
|
|
66
|
+
.title {
|
|
67
|
+
font-size: calc(0.9 * var(--theme-font-size-base, 1rem));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.role {
|
|
72
|
+
border-block-start: 0.5px solid var(--tr-muted-grey);
|
|
73
|
+
margin-inline-start: -0.75rem;
|
|
74
|
+
padding-inline-start: 0.75rem;
|
|
75
|
+
margin-block-start: 0.25rem;
|
|
76
|
+
padding-block-start: 0.25rem;
|
|
77
|
+
font-family: var(--theme-font-family-note);
|
|
78
|
+
color: var(--theme-colour-text-secondary);
|
|
79
|
+
font-size: var(--theme-font-size-sm);
|
|
80
|
+
font-weight: 300;
|
|
81
|
+
line-height: 1.15;
|
|
82
|
+
margin-block-end: clamp(1.13rem, 1.06rem + 0.31vw, 1.31rem);
|
|
83
|
+
}
|
|
84
|
+
@media (max-width: 450px) {
|
|
85
|
+
.role {
|
|
86
|
+
font-size: var(--theme-font-size-xs);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.description :global(p) {
|
|
91
|
+
font-family: var(--theme-font-family-note);
|
|
92
|
+
font-size: calc(0.9 * var(--theme-font-size-base, 1rem));
|
|
93
|
+
font-weight: 300;
|
|
94
|
+
margin-block-end: 0;
|
|
95
|
+
text-wrap: pretty;
|
|
96
|
+
}
|
|
97
|
+
.description.desktop {
|
|
98
|
+
display: block;
|
|
99
|
+
}
|
|
100
|
+
.description.mobile {
|
|
101
|
+
display: none;
|
|
102
|
+
}
|
|
103
|
+
@media (max-width: 600px) {
|
|
104
|
+
.description.desktop {
|
|
105
|
+
display: none;
|
|
106
|
+
}
|
|
107
|
+
.description.mobile {
|
|
108
|
+
display: block;
|
|
109
|
+
}
|
|
110
|
+
}</style>
|
|
Binary file
|
|
Binary file
|
|
@@ -67,8 +67,9 @@ https://utopia.fyi/space/calculator/?c=320,18,1.125,1280,21,1.25,7,3,&s=0.75|0.5
|
|
|
67
67
|
*/
|
|
68
68
|
/* Scales by 1.125 */
|
|
69
69
|
.scroller-demo-container {
|
|
70
|
-
width: 660px;
|
|
70
|
+
max-width: 660px;
|
|
71
71
|
margin: auto;
|
|
72
|
+
background: #c5dfe8;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
.step-foreground-container {
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { default as FeaturePhoto } from './components/FeaturePhoto/FeaturePhoto.
|
|
|
14
14
|
export { default as Framer } from './components/Framer/Framer.svelte';
|
|
15
15
|
export { default as GraphicBlock } from './components/GraphicBlock/GraphicBlock.svelte';
|
|
16
16
|
export { default as Headline } from './components/Headline/Headline.svelte';
|
|
17
|
+
export { default as Headpile } from './components/Headpile/Headpile.svelte';
|
|
17
18
|
export { default as HeroHeadline } from './components/HeroHeadline/HeroHeadline.svelte';
|
|
18
19
|
export { default as EndNotes } from './components/EndNotes/EndNotes.svelte';
|
|
19
20
|
export { default as InfoBox } from './components/InfoBox/InfoBox.svelte';
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { default as FeaturePhoto } from './components/FeaturePhoto/FeaturePhoto.
|
|
|
16
16
|
export { default as Framer } from './components/Framer/Framer.svelte';
|
|
17
17
|
export { default as GraphicBlock } from './components/GraphicBlock/GraphicBlock.svelte';
|
|
18
18
|
export { default as Headline } from './components/Headline/Headline.svelte';
|
|
19
|
+
export { default as Headpile } from './components/Headpile/Headpile.svelte';
|
|
19
20
|
export { default as HeroHeadline } from './components/HeroHeadline/HeroHeadline.svelte';
|
|
20
21
|
export { default as EndNotes } from './components/EndNotes/EndNotes.svelte';
|
|
21
22
|
export { default as InfoBox } from './components/InfoBox/InfoBox.svelte';
|