@reuters-graphics/graphics-components 0.0.2 → 0.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.
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
/**
|
|
5
|
+
* An array of dates with events.
|
|
6
|
+
* @required
|
|
7
|
+
*/ dates: {
|
|
8
|
+
date: string;
|
|
9
|
+
events: {
|
|
10
|
+
title: string;
|
|
11
|
+
titleLink?: string;
|
|
12
|
+
context?: string;
|
|
13
|
+
}[];
|
|
14
|
+
}[];
|
|
15
|
+
/**
|
|
16
|
+
* Set a colour for the timeline bullet symbols and line.
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/ symbolColour?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Set a colour for the date headings in the timeline.
|
|
21
|
+
* @type {string}
|
|
22
|
+
*/ dateColour?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Set a class to target with SCSS.
|
|
25
|
+
* @type {string}
|
|
26
|
+
*/ cls?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Set an ID to target with SCSS.
|
|
29
|
+
* @type {string}
|
|
30
|
+
*/ id?: string;
|
|
31
|
+
};
|
|
32
|
+
events: {
|
|
33
|
+
[evt: string]: CustomEvent<any>;
|
|
34
|
+
};
|
|
35
|
+
slots: {};
|
|
36
|
+
};
|
|
37
|
+
export declare type SimpleTimelineProps = typeof __propDef.props;
|
|
38
|
+
export declare type SimpleTimelineEvents = typeof __propDef.events;
|
|
39
|
+
export declare type SimpleTimelineSlots = typeof __propDef.slots;
|
|
40
|
+
/** `SimpleTimeline` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-SimpleTimeline--default) */
|
|
41
|
+
export default class SimpleTimeline extends SvelteComponentTyped<SimpleTimelineProps, SimpleTimelineEvents, SimpleTimelineSlots> {
|
|
42
|
+
}
|
|
43
|
+
export {};
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { default as ReutersLogo } from "./components/ReutersLogo/ReutersLogo.sve
|
|
|
17
17
|
export { default as Scroller } from "./components/Scroller/Scroller.svelte";
|
|
18
18
|
export { default as SEO } from "./components/SEO/SEO.svelte";
|
|
19
19
|
export { default as Sharer } from "./components/Sharer/Sharer.svelte";
|
|
20
|
+
export { default as SimpleTimeline } from "./components/SimpleTimeline/SimpleTimeline.svelte";
|
|
20
21
|
export { default as SiteFooter } from "./components/SiteFooter/SiteFooter.svelte";
|
|
21
22
|
export { default as SiteHeader } from "./components/SiteHeader/SiteHeader.svelte";
|
|
22
23
|
export { default as Spinner } from "./components/Spinner/Spinner.svelte";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<!-- @component `SimpleTimeline` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-SimpleTimeline--default) -->
|
|
2
|
+
<script>/**
|
|
3
|
+
* An array of dates with events.
|
|
4
|
+
* @required
|
|
5
|
+
*/
|
|
6
|
+
export let dates;
|
|
7
|
+
/**
|
|
8
|
+
* Set a colour for the timeline bullet symbols and line.
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
export let symbolColour = '#ccc';
|
|
12
|
+
/**
|
|
13
|
+
* Set a colour for the date headings in the timeline.
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
export let dateColour = 'var(--theme-colour-accent, red)';
|
|
17
|
+
/**
|
|
18
|
+
* Set a class to target with SCSS.
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
export let cls = '';
|
|
22
|
+
/**
|
|
23
|
+
* Set an ID to target with SCSS.
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
export let id = '';
|
|
27
|
+
import Block from '../Block/Block.svelte';
|
|
28
|
+
import Fa from 'svelte-fa/src/fa.svelte';
|
|
29
|
+
import { faLink } from '@fortawesome/free-solid-svg-icons';
|
|
30
|
+
import { marked } from 'marked';
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<Block width="normal" id="{id}" cls="simple-timeline-container {cls}">
|
|
34
|
+
<div class="timeline" style="--symbol-colour:{symbolColour};">
|
|
35
|
+
{#each dates as date}
|
|
36
|
+
<div class="date">
|
|
37
|
+
<svg height="25" width="20">
|
|
38
|
+
<circle
|
|
39
|
+
cx="10"
|
|
40
|
+
cy="12"
|
|
41
|
+
r="5"
|
|
42
|
+
stroke="{symbolColour}"
|
|
43
|
+
stroke-width="2"
|
|
44
|
+
fill="transparent"></circle>
|
|
45
|
+
</svg>
|
|
46
|
+
<h5 style:color="{dateColour}">{date.date}</h5>
|
|
47
|
+
{#each date.events as event}
|
|
48
|
+
<div class="event pb-2">
|
|
49
|
+
{#if event.titleLink}
|
|
50
|
+
<a href="{event.titleLink}" target="_blank">
|
|
51
|
+
<h6>
|
|
52
|
+
{event.title} <span><Fa fw icon="{faLink}" /></span>
|
|
53
|
+
</h6>
|
|
54
|
+
</a>
|
|
55
|
+
{:else}
|
|
56
|
+
<h6>{event.title}</h6>
|
|
57
|
+
{/if}
|
|
58
|
+
{#if event.context}
|
|
59
|
+
{@html marked(event.context)}
|
|
60
|
+
{/if}
|
|
61
|
+
</div>
|
|
62
|
+
{/each}
|
|
63
|
+
</div>
|
|
64
|
+
{/each}
|
|
65
|
+
</div>
|
|
66
|
+
</Block>
|
|
67
|
+
|
|
68
|
+
<style>.timeline {
|
|
69
|
+
margin-top: 2rem;
|
|
70
|
+
padding-left: 8px;
|
|
71
|
+
padding-right: 15px;
|
|
72
|
+
}
|
|
73
|
+
.timeline .date {
|
|
74
|
+
border-left: 1px solid var(--symbol-colour);
|
|
75
|
+
padding-left: 20px;
|
|
76
|
+
padding-bottom: 1rem;
|
|
77
|
+
position: relative;
|
|
78
|
+
margin: 0;
|
|
79
|
+
display: block;
|
|
80
|
+
}
|
|
81
|
+
.timeline .date:last-child {
|
|
82
|
+
border-left: 1px solid var(--theme-colour-background, #fff);
|
|
83
|
+
}
|
|
84
|
+
.timeline .date h5 {
|
|
85
|
+
font-size: 0.95rem;
|
|
86
|
+
margin-top: 0px;
|
|
87
|
+
}
|
|
88
|
+
.timeline svg {
|
|
89
|
+
background-color: var(--theme-colour-background, #fff);
|
|
90
|
+
position: absolute;
|
|
91
|
+
top: -1px;
|
|
92
|
+
left: -10px;
|
|
93
|
+
}
|
|
94
|
+
.timeline div.event h6 {
|
|
95
|
+
margin: 0;
|
|
96
|
+
font-size: 1.2rem;
|
|
97
|
+
color: var(--theme-colour-text-primary, #666);
|
|
98
|
+
}
|
|
99
|
+
.timeline div.event a {
|
|
100
|
+
color: var(--theme-colour-text-primary, #666);
|
|
101
|
+
text-decoration: none;
|
|
102
|
+
}
|
|
103
|
+
.timeline div.event a:hover {
|
|
104
|
+
text-decoration: underline;
|
|
105
|
+
}
|
|
106
|
+
.timeline div.event a h6 span {
|
|
107
|
+
opacity: 0.5;
|
|
108
|
+
font-size: 1rem;
|
|
109
|
+
}
|
|
110
|
+
.timeline div.event a h6:hover span {
|
|
111
|
+
opacity: 0.8;
|
|
112
|
+
}
|
|
113
|
+
.timeline div.event :global(p) {
|
|
114
|
+
margin-top: 0;
|
|
115
|
+
margin-bottom: 0.7rem;
|
|
116
|
+
font-size: 1rem;
|
|
117
|
+
font-weight: 300;
|
|
118
|
+
color: var(--theme-colour-text-primary, #666);
|
|
119
|
+
font-family: var(--theme-font-family-sans-serif);
|
|
120
|
+
}
|
|
121
|
+
.timeline div.event :global(p):last-of-type {
|
|
122
|
+
margin-bottom: 0;
|
|
123
|
+
}
|
|
124
|
+
.timeline div.event :global(a) {
|
|
125
|
+
color: var(--theme-colour-text-primary, #666);
|
|
126
|
+
}</style>
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export { default as ReutersLogo } from './components/ReutersLogo/ReutersLogo.sve
|
|
|
18
18
|
export { default as Scroller } from './components/Scroller/Scroller.svelte';
|
|
19
19
|
export { default as SEO } from './components/SEO/SEO.svelte';
|
|
20
20
|
export { default as Sharer } from './components/Sharer/Sharer.svelte';
|
|
21
|
+
export { default as SimpleTimeline } from './components/SimpleTimeline/SimpleTimeline.svelte';
|
|
21
22
|
export { default as SiteFooter } from './components/SiteFooter/SiteFooter.svelte';
|
|
22
23
|
export { default as SiteHeader } from './components/SiteHeader/SiteHeader.svelte';
|
|
23
24
|
export { default as Spinner } from './components/Spinner/Spinner.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reuters-graphics/graphics-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://reuters-graphics.github.io/graphics-components",
|
|
@@ -133,6 +133,7 @@
|
|
|
133
133
|
"./components/Sharer/utils/facebook": "./dist/components/Sharer/utils/facebook.js",
|
|
134
134
|
"./components/Sharer/utils/meta": "./dist/components/Sharer/utils/meta.js",
|
|
135
135
|
"./components/Sharer/utils/twitter": "./dist/components/Sharer/utils/twitter.js",
|
|
136
|
+
"./components/SimpleTimeline/SimpleTimeline.svelte": "./dist/components/SimpleTimeline/SimpleTimeline.svelte",
|
|
136
137
|
"./components/SiteFooter/CompanyLinks.svelte": "./dist/components/SiteFooter/CompanyLinks.svelte",
|
|
137
138
|
"./components/SiteFooter/LegalLinks.svelte": "./dist/components/SiteFooter/LegalLinks.svelte",
|
|
138
139
|
"./components/SiteFooter/QuickLinks.svelte": "./dist/components/SiteFooter/QuickLinks.svelte",
|