@reuters-graphics/graphics-components 2.0.1 → 2.0.3
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/Block/Block.stories.svelte +7 -1
- package/dist/components/Block/Block.stories.svelte.d.ts +8 -5
- package/dist/components/ReferralBlock/ReferralBlock.svelte +21 -8
- package/dist/components/SEO/SEO.svelte +12 -14
- package/dist/components/Scroller/stories/docs/ai2svelte.md +0 -82
- package/dist/components/Scroller/stories/docs/archieML.md +1 -1
- package/dist/components/SiteHeader/NavBar/NavDropdown/StoryCard/index.svelte +12 -5
- package/package.json +2 -1
|
@@ -3,10 +3,16 @@ import customLayoutsDocs from "./stories/docs/customLayouts.md?raw";
|
|
|
3
3
|
import snapWidthsDocs from "./stories/docs/snapWidths.md?raw";
|
|
4
4
|
import Block from "./Block.svelte";
|
|
5
5
|
import { withComponentDocs, withStoryDocs } from "$docs/utils/withParams.js";
|
|
6
|
+
import { toId } from "@storybook/csf";
|
|
6
7
|
export const meta = {
|
|
7
8
|
title: "Components/Page layout/Block",
|
|
8
9
|
component: Block,
|
|
9
|
-
|
|
10
|
+
parameters: {
|
|
11
|
+
...withComponentDocs(componentDocs).parameters,
|
|
12
|
+
canvasDocs: {
|
|
13
|
+
[toId("Components/Page layout/Block", "default")]: componentDocs
|
|
14
|
+
}
|
|
15
|
+
},
|
|
10
16
|
argTypes: {
|
|
11
17
|
width: {
|
|
12
18
|
control: "select",
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
export declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: typeof Block;
|
|
5
|
+
parameters: {
|
|
6
|
+
canvasDocs: {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
};
|
|
9
|
+
docs: any;
|
|
10
|
+
};
|
|
3
11
|
argTypes: {
|
|
4
12
|
width: {
|
|
5
13
|
control: string;
|
|
6
14
|
options: string[];
|
|
7
15
|
};
|
|
8
16
|
};
|
|
9
|
-
parameters: {
|
|
10
|
-
docs: any;
|
|
11
|
-
};
|
|
12
|
-
title: string;
|
|
13
|
-
component: typeof Block;
|
|
14
17
|
};
|
|
15
18
|
declare const __propDef: {
|
|
16
19
|
props: Record<string, never>;
|
|
@@ -31,7 +31,9 @@ const getReferrals = async () => {
|
|
|
31
31
|
})
|
|
32
32
|
);
|
|
33
33
|
const data = await response.json();
|
|
34
|
-
const articles = data.result.articles.filter((a) => a?.headline_category || a?.kicker?.name).filter(
|
|
34
|
+
const articles = data.result.articles.filter((a) => a?.headline_category || a?.kicker?.name).filter(
|
|
35
|
+
(a) => a?.thumbnail?.renditions?.landscape?.["240w"] || a?.thumbnail?.resizer_url
|
|
36
|
+
).filter((a) => !a?.content?.third_party).filter(articleIsNotCurrentPage).slice(0, number);
|
|
35
37
|
referrals = articles;
|
|
36
38
|
} catch {
|
|
37
39
|
console.warn("Unable to fetch referral links.");
|
|
@@ -95,13 +97,24 @@ onMount(getReferrals);
|
|
|
95
97
|
class="image-container block m-0 overflow-hidden relative"
|
|
96
98
|
class:xs="{clientWidth && clientWidth < 450}"
|
|
97
99
|
>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
{#if referral.thumbnail.resizer_url}
|
|
101
|
+
<img
|
|
102
|
+
class="block object-cover m-0 w-full"
|
|
103
|
+
data-chromatic="ignore"
|
|
104
|
+
src="{referral.thumbnail
|
|
105
|
+
.resizer_url}&width=120&quality=80"
|
|
106
|
+
alt="{referral.thumbnail.caption ||
|
|
107
|
+
referral.thumbnail.alt_text}"
|
|
108
|
+
/>
|
|
109
|
+
{:else}
|
|
110
|
+
<img
|
|
111
|
+
class="block object-cover m-0 w-full"
|
|
112
|
+
data-chromatic="ignore"
|
|
113
|
+
src="{referral.thumbnail.renditions.landscape['240w']}"
|
|
114
|
+
alt="{referral.thumbnail.caption ||
|
|
115
|
+
referral.thumbnail.alt_text}"
|
|
116
|
+
/>
|
|
117
|
+
{/if}
|
|
105
118
|
</div>
|
|
106
119
|
</div>
|
|
107
120
|
</a>
|
|
@@ -74,28 +74,26 @@ $: articleLdJson = {
|
|
|
74
74
|
<title>{seoTitle}</title>
|
|
75
75
|
<meta name="description" content="{seoDescription}" />
|
|
76
76
|
<link rel="canonical" href="{canonicalUrl}" />
|
|
77
|
-
<link
|
|
78
|
-
rel="shortcut icon"
|
|
79
|
-
type="image/x-icon"
|
|
80
|
-
href="https://s3.reutersmedia.net/resources_v2/images/favicon/favicon.ico"
|
|
81
|
-
/>
|
|
82
77
|
<link
|
|
83
78
|
rel="icon"
|
|
84
79
|
type="image/png"
|
|
85
|
-
href="https://
|
|
86
|
-
sizes="
|
|
80
|
+
href="https://graphics.thomsonreuters.com/style-assets/images/logos/favicon/favicon-96x96.png"
|
|
81
|
+
sizes="96x96"
|
|
87
82
|
/>
|
|
88
83
|
<link
|
|
89
84
|
rel="icon"
|
|
90
|
-
type="image/
|
|
91
|
-
href="https://
|
|
92
|
-
sizes="32x32"
|
|
85
|
+
type="image/svg+xml"
|
|
86
|
+
href="https://graphics.thomsonreuters.com/style-assets/images/logos/favicon/kinesis.svg"
|
|
93
87
|
/>
|
|
94
88
|
<link
|
|
95
|
-
rel="icon"
|
|
96
|
-
type="image/
|
|
97
|
-
href="https://
|
|
98
|
-
|
|
89
|
+
rel="shortcut icon"
|
|
90
|
+
type="image/x-icon"
|
|
91
|
+
href="https://graphics.thomsonreuters.com/style-assets/images/logos/favicon/favicon.ico"
|
|
92
|
+
/>
|
|
93
|
+
<link
|
|
94
|
+
rel="apple-touch-icon"
|
|
95
|
+
sizes="180x180"
|
|
96
|
+
href="https://graphics.thomsonreuters.com/style-assets/images/logos/favicon/apple-touch-icon.png"
|
|
99
97
|
/>
|
|
100
98
|
|
|
101
99
|
<meta property="og:url" content="{canonicalUrl}" />
|
|
@@ -40,85 +40,3 @@ A more detailed example of using `Scroller` with graphics created by [ai2svelte]
|
|
|
40
40
|
embedded="{false}"
|
|
41
41
|
/>
|
|
42
42
|
```
|
|
43
|
-
|
|
44
|
-
When working with a ArchieML doc, here's an example of how you can tie your text into your steps.
|
|
45
|
-
|
|
46
|
-
```yaml
|
|
47
|
-
# Google doc block
|
|
48
|
-
Type: scroller
|
|
49
|
-
ID: map-scrolly
|
|
50
|
-
Step1Text: #### Step 1
|
|
51
|
-
|
|
52
|
-
Lorem Ipsum
|
|
53
|
-
:end
|
|
54
|
-
AltText1: A map showing the Upper West side in New York City.
|
|
55
|
-
:end
|
|
56
|
-
|
|
57
|
-
Step2Text: #### Step 2
|
|
58
|
-
|
|
59
|
-
Lorem Ipsum
|
|
60
|
-
:end
|
|
61
|
-
AltText2: The same map now highlights 98th Street.
|
|
62
|
-
:end
|
|
63
|
-
|
|
64
|
-
Step3Text: #### Step 3
|
|
65
|
-
|
|
66
|
-
Lorem Ipsum
|
|
67
|
-
:end
|
|
68
|
-
AltText3: The same map now highlights three locations near 98th Street where something particulary important happened.
|
|
69
|
-
:end
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
```svelte
|
|
73
|
-
<!-- App.svelte -->
|
|
74
|
-
<script>
|
|
75
|
-
// Previos imports and stuff...
|
|
76
|
-
|
|
77
|
-
// This should be already imported for you.
|
|
78
|
-
import content from '$locales/en/content.json';
|
|
79
|
-
|
|
80
|
-
// Get the data for the block in content by its ID
|
|
81
|
-
const scrollerBlock = content.blocks.find(
|
|
82
|
-
(block) => block.ID === 'map-scrolly'
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
// Now plug your text into your step foregrounds
|
|
86
|
-
const steps = [
|
|
87
|
-
{
|
|
88
|
-
background: MyAiMap1,
|
|
89
|
-
backgroundProps: { basePath: assets },
|
|
90
|
-
foreground: scrollerBlock.Step1Text,
|
|
91
|
-
altText: scrollerBlock.AltText1,
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
background: MyAiMap2,
|
|
95
|
-
backgroundProps: { basePath: assets },
|
|
96
|
-
foreground: scrollerBlock.Step2Text,
|
|
97
|
-
altText: scrollerBlock.AltText2,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
background: MyAiMap3,
|
|
101
|
-
backgroundProps: { basePath: assets },
|
|
102
|
-
foreground: scrollerBlock.Step3Text,
|
|
103
|
-
altText: scrollerBlock.AltText3,
|
|
104
|
-
},
|
|
105
|
-
];
|
|
106
|
-
</script>
|
|
107
|
-
|
|
108
|
-
{#each content.blocks as block}
|
|
109
|
-
{#if block.Type === 'text'}
|
|
110
|
-
<!-- ... other blocks -->
|
|
111
|
-
|
|
112
|
-
<!-- Copy/paste into your blocks loop! -->
|
|
113
|
-
{:else if block.Type === 'scroller' && block.ID === 'map-scrolly'}
|
|
114
|
-
<Scroller
|
|
115
|
-
steps="{steps}"
|
|
116
|
-
backgroundWidth="fluid"
|
|
117
|
-
foregroundPosition="middle"
|
|
118
|
-
stackBackground="{true}"
|
|
119
|
-
embedded="{false}"
|
|
120
|
-
/>
|
|
121
|
-
<!-- END copy/paste -->
|
|
122
|
-
{/if}
|
|
123
|
-
{/each}
|
|
124
|
-
```
|
|
@@ -75,7 +75,7 @@ stackBackground: true
|
|
|
75
75
|
stackBackground="{block.stackBackground === 'true'}"
|
|
76
76
|
steps="{block.steps.map((step) => ({
|
|
77
77
|
background: aiCharts[step.background],
|
|
78
|
-
backgroundProps: assets || '/',
|
|
78
|
+
backgroundProps: { assetsPath: assets || '/' },
|
|
79
79
|
foreground: step.text,
|
|
80
80
|
altText: step.altText,
|
|
81
81
|
}))}"
|
|
@@ -13,12 +13,19 @@
|
|
|
13
13
|
<span>{story.title}</span>
|
|
14
14
|
<time datetime="{story.display_time}">{getTime(story.display_time)}</time>
|
|
15
15
|
</div>
|
|
16
|
-
{#if thumbnail}
|
|
16
|
+
{#if thumbnail && (thumbnail.resizer_url || thumbnail?.renditions?.square?.['120w'])}
|
|
17
17
|
<div class="thumbnail">
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
{#if thumbnail.resizer_url}
|
|
19
|
+
<img
|
|
20
|
+
src="{thumbnail.resizer_url}&width=120&quality=80"
|
|
21
|
+
alt="{thumbnail.alt_text}"
|
|
22
|
+
/>
|
|
23
|
+
{:else}
|
|
24
|
+
<img
|
|
25
|
+
src="{thumbnail.renditions.square['120w']}"
|
|
26
|
+
alt="{thumbnail.alt_text}"
|
|
27
|
+
/>
|
|
28
|
+
{/if}
|
|
22
29
|
</div>
|
|
23
30
|
{/if}
|
|
24
31
|
</a>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reuters-graphics/graphics-components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://reuters-graphics.github.io/graphics-components",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@storybook/blocks": "^8.4.4",
|
|
43
43
|
"@storybook/builder-vite": "^8.4.4",
|
|
44
44
|
"@storybook/components": "^8.4.4",
|
|
45
|
+
"@storybook/csf": "^0.1.12",
|
|
45
46
|
"@storybook/manager-api": "^8.4.4",
|
|
46
47
|
"@storybook/mdx2-csf": "^1.1.0",
|
|
47
48
|
"@storybook/svelte": "^8.4.4",
|