@reuters-graphics/graphics-components 0.0.1-beta.1
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/README.md +7 -0
- package/dist/@types/actions/cssVariables/index.d.ts +4 -0
- package/dist/@types/actions/resizeObserver/index.d.ts +4 -0
- package/dist/@types/components/@types/global.d.ts +28 -0
- package/dist/@types/components/Article/Article.svelte.d.ts +32 -0
- package/dist/@types/components/BeforeAfter/BeforeAfter.svelte.d.ts +57 -0
- package/dist/@types/components/Block/Block.svelte.d.ts +24 -0
- package/dist/@types/components/BodyText/BodyText.svelte.d.ts +20 -0
- package/dist/@types/components/DatawrapperChart/DatawrapperChart.svelte.d.ts +52 -0
- package/dist/@types/components/EmbedPreviewerLink/EmbedPreviewerLink.svelte.d.ts +16 -0
- package/dist/@types/components/FeaturePhoto/FeaturePhoto.svelte.d.ts +43 -0
- package/dist/@types/components/Framer/Framer.svelte.d.ts +29 -0
- package/dist/@types/components/Framer/Resizer/index.svelte.d.ts +27 -0
- package/dist/@types/components/Framer/stores.d.ts +1 -0
- package/dist/@types/components/Framer/uniqNames.d.ts +2 -0
- package/dist/@types/components/GraphicBlock/AriaHidden.svelte.d.ts +20 -0
- package/dist/@types/components/GraphicBlock/GraphicBlock.svelte.d.ts +64 -0
- package/dist/@types/components/GraphicBlock/TextBlock.svelte.d.ts +19 -0
- package/dist/@types/components/Headline/Headline.svelte.d.ts +29 -0
- package/dist/@types/components/Hero/Hero.svelte.d.ts +41 -0
- package/dist/@types/components/NoteText/NoteText.svelte.d.ts +20 -0
- package/dist/@types/components/PaddingReset/index.svelte.d.ts +27 -0
- package/dist/@types/components/PhotoPack/PhotoPack.svelte.d.ts +50 -0
- package/dist/@types/components/PhotoPack/docProps.d.ts +38 -0
- package/dist/@types/components/PymChild/PymChild.svelte.d.ts +16 -0
- package/dist/@types/components/ReutersLogo/ReutersLogo.svelte.d.ts +18 -0
- package/dist/@types/components/SEO/SEO.svelte.d.ts +66 -0
- package/dist/@types/components/SEO/analytics.d.ts +2 -0
- package/dist/@types/components/SEO/publisherTags.d.ts +2 -0
- package/dist/@types/components/Scroller/Background.svelte.d.ts +20 -0
- package/dist/@types/components/Scroller/Embedded/Background.svelte.d.ts +19 -0
- package/dist/@types/components/Scroller/Embedded/Foreground.svelte.d.ts +18 -0
- package/dist/@types/components/Scroller/Embedded/index.svelte.d.ts +19 -0
- package/dist/@types/components/Scroller/Foreground.svelte.d.ts +17 -0
- package/dist/@types/components/Scroller/Scroller.svelte.d.ts +76 -0
- package/dist/@types/components/Sharer/Sharer.svelte.d.ts +19 -0
- package/dist/@types/components/Sharer/utils/copyToClipboard.d.ts +2 -0
- package/dist/@types/components/Sharer/utils/facebook.d.ts +2 -0
- package/dist/@types/components/Sharer/utils/meta.d.ts +2 -0
- package/dist/@types/components/Sharer/utils/twitter.d.ts +2 -0
- package/dist/@types/components/SiteFooter/CompanyLinks.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/LegalLinks.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/QuickLinks.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/Referrals/IntersectionObserver.svelte.d.ts +39 -0
- package/dist/@types/components/SiteFooter/Referrals/Link.svelte.d.ts +29 -0
- package/dist/@types/components/SiteFooter/Referrals/Referrals.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/Referrals/index.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/SiteFooter.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/Facebook.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/Graphics.svelte.d.ts +19 -0
- package/dist/@types/components/SiteFooter/svgs/Instagram.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/LinkedIn.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/Pictures.svelte.d.ts +19 -0
- package/dist/@types/components/SiteFooter/svgs/Twitter.svelte.d.ts +23 -0
- package/dist/@types/components/SiteFooter/svgs/Videos.svelte.d.ts +19 -0
- package/dist/@types/components/SiteFooter/svgs/YouTube.svelte.d.ts +23 -0
- package/dist/@types/components/SiteHeader/MobileMenu/index.svelte.d.ts +27 -0
- package/dist/@types/components/SiteHeader/NavBar/DownArrow.svelte.d.ts +23 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/MoreDropdown.svelte.d.ts +23 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/SectionDropdown.svelte.d.ts +25 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/Spinner/index.svelte.d.ts +19 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/StoryCard/index.svelte.d.ts +25 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/StoryCard/time.d.ts +1 -0
- package/dist/@types/components/SiteHeader/NavBar/NavDropdown/index.svelte.d.ts +27 -0
- package/dist/@types/components/SiteHeader/NavBar/index.svelte.d.ts +23 -0
- package/dist/@types/components/SiteHeader/NavBar/utils/index.d.ts +1 -0
- package/dist/@types/components/SiteHeader/SiteHeader.svelte.d.ts +14 -0
- package/dist/@types/components/SiteHeader/svgs/Close.svelte.d.ts +19 -0
- package/dist/@types/components/SiteHeader/svgs/Menu.svelte.d.ts +23 -0
- package/dist/@types/components/Spinner/Spinner.svelte.d.ts +28 -0
- package/dist/@types/components/Theme/@types/component.d.ts +28 -0
- package/dist/@types/components/Theme/Theme.svelte.d.ts +54 -0
- package/dist/@types/components/Theme/themes/dark.d.ts +2 -0
- package/dist/@types/components/Theme/themes/light.d.ts +22 -0
- package/dist/@types/components/Theme/utils/flatten.d.ts +1 -0
- package/dist/@types/components/Theme/utils/merge.d.ts +4 -0
- package/dist/@types/components/Video/Controls.svelte.d.ts +45 -0
- package/dist/@types/components/Video/Video.svelte.d.ts +46 -0
- package/dist/@types/components/Visible/Visible.svelte.d.ts +29 -0
- package/dist/@types/index.d.ts +24 -0
- package/dist/actions/cssVariables/index.js +20 -0
- package/dist/actions/resizeObserver/index.js +25 -0
- package/dist/components/@types/global.js +1 -0
- package/dist/components/Article/Article.svelte +47 -0
- package/dist/components/BeforeAfter/BeforeAfter.svelte +341 -0
- package/dist/components/Block/Block.svelte +177 -0
- package/dist/components/BodyText/BodyText.svelte +193 -0
- package/dist/components/DatawrapperChart/DatawrapperChart.svelte +105 -0
- package/dist/components/EmbedPreviewerLink/EmbedPreviewerLink.svelte +26 -0
- package/dist/components/FeaturePhoto/FeaturePhoto.svelte +113 -0
- package/dist/components/Framer/Framer.svelte +136 -0
- package/dist/components/Framer/Resizer/index.svelte +223 -0
- package/dist/components/Framer/stores.js +3 -0
- package/dist/components/Framer/uniqNames.js +54 -0
- package/dist/components/GraphicBlock/AriaHidden.svelte +13 -0
- package/dist/components/GraphicBlock/GraphicBlock.svelte +269 -0
- package/dist/components/GraphicBlock/TextBlock.svelte +12 -0
- package/dist/components/Headline/Headline.svelte +109 -0
- package/dist/components/Hero/Hero.svelte +78 -0
- package/dist/components/NoteText/NoteText.svelte +124 -0
- package/dist/components/PaddingReset/index.svelte +17 -0
- package/dist/components/PhotoPack/PhotoPack.svelte +156 -0
- package/dist/components/PhotoPack/docProps.js +20 -0
- package/dist/components/PymChild/PymChild.svelte +10 -0
- package/dist/components/ReutersLogo/ReutersLogo.svelte +21 -0
- package/dist/components/SEO/SEO.svelte +179 -0
- package/dist/components/SEO/analytics.js +332 -0
- package/dist/components/SEO/publisherTags.js +26 -0
- package/dist/components/Scroller/Background.svelte +30 -0
- package/dist/components/Scroller/Embedded/Background.svelte +14 -0
- package/dist/components/Scroller/Embedded/Foreground.svelte +203 -0
- package/dist/components/Scroller/Embedded/index.svelte +18 -0
- package/dist/components/Scroller/Foreground.svelte +42 -0
- package/dist/components/Scroller/Scroller.svelte +210 -0
- package/dist/components/Sharer/Sharer.svelte +157 -0
- package/dist/components/Sharer/utils/copyToClipboard.js +10 -0
- package/dist/components/Sharer/utils/facebook.js +22 -0
- package/dist/components/Sharer/utils/meta.js +7 -0
- package/dist/components/Sharer/utils/twitter.js +22 -0
- package/dist/components/SiteFooter/CompanyLinks.svelte +173 -0
- package/dist/components/SiteFooter/LegalLinks.svelte +202 -0
- package/dist/components/SiteFooter/QuickLinks.svelte +259 -0
- package/dist/components/SiteFooter/Referrals/IntersectionObserver.svelte +45 -0
- package/dist/components/SiteFooter/Referrals/Link.svelte +73 -0
- package/dist/components/SiteFooter/Referrals/Referrals.svelte +56 -0
- package/dist/components/SiteFooter/Referrals/index.svelte +53 -0
- package/dist/components/SiteFooter/SiteFooter.svelte +41 -0
- package/dist/components/SiteFooter/data.json +210 -0
- package/dist/components/SiteFooter/svgs/Facebook.svelte +18 -0
- package/dist/components/SiteFooter/svgs/Graphics.svelte +18 -0
- package/dist/components/SiteFooter/svgs/Instagram.svelte +20 -0
- package/dist/components/SiteFooter/svgs/LinkedIn.svelte +18 -0
- package/dist/components/SiteFooter/svgs/Pictures.svelte +14 -0
- package/dist/components/SiteFooter/svgs/Twitter.svelte +18 -0
- package/dist/components/SiteFooter/svgs/Videos.svelte +14 -0
- package/dist/components/SiteFooter/svgs/YouTube.svelte +18 -0
- package/dist/components/SiteHeader/MobileMenu/index.svelte +199 -0
- package/dist/components/SiteHeader/NavBar/DownArrow.svelte +26 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/MoreDropdown.svelte +112 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/SectionDropdown.svelte +118 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/Spinner/index.svelte +49 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/StoryCard/index.svelte +99 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/StoryCard/time.js +70 -0
- package/dist/components/SiteHeader/NavBar/NavDropdown/index.svelte +277 -0
- package/dist/components/SiteHeader/NavBar/index.svelte +234 -0
- package/dist/components/SiteHeader/NavBar/utils/index.js +2 -0
- package/dist/components/SiteHeader/SiteHeader.svelte +235 -0
- package/dist/components/SiteHeader/data.json +1 -0
- package/dist/components/SiteHeader/scss/_breakpoints.scss +59 -0
- package/dist/components/SiteHeader/scss/_colors.scss +25 -0
- package/dist/components/SiteHeader/scss/_eases.scss +9 -0
- package/dist/components/SiteHeader/scss/_grids.scss +126 -0
- package/dist/components/SiteHeader/scss/_z-indexes.scss +15 -0
- package/dist/components/SiteHeader/svgs/Close.svelte +14 -0
- package/dist/components/SiteHeader/svgs/Menu.svelte +19 -0
- package/dist/components/Spinner/Spinner.svelte +91 -0
- package/dist/components/Theme/@types/component.js +3 -0
- package/dist/components/Theme/Theme.svelte +37 -0
- package/dist/components/Theme/themes/dark.js +23 -0
- package/dist/components/Theme/themes/light.js +22 -0
- package/dist/components/Theme/utils/flatten.js +39 -0
- package/dist/components/Theme/utils/merge.js +23 -0
- package/dist/components/Video/Controls.svelte +68 -0
- package/dist/components/Video/Video.svelte +278 -0
- package/dist/components/Visible/Visible.svelte +54 -0
- package/dist/index.js +31 -0
- package/dist/scss/_mixins.scss +6 -0
- package/dist/scss/_variables.scss +2 -0
- package/dist/scss/bootstrap/_main.scss +34 -0
- package/dist/scss/bootstrap/_variables.scss +10 -0
- package/dist/scss/colours/thematic/_nord.scss +40 -0
- package/dist/scss/colours/thematic/_tr.scss +27 -0
- package/dist/scss/components/_hero-title.scss +118 -0
- package/dist/scss/fonts/_font-faces.scss +129 -0
- package/dist/scss/fonts/_mixins.scss +25 -0
- package/dist/scss/fonts/_rules.scss +19 -0
- package/dist/scss/fonts/_variables.scss +26 -0
- package/dist/scss/main.scss +16 -0
- package/dist/scss/mixins/_block.scss +62 -0
- package/dist/scss/mixins/_body-text.scss +113 -0
- package/dist/scss/mixins/_graphic.scss +66 -0
- package/dist/scss/mixins/_note-text.scss +34 -0
- package/dist/scss/mixins/_visually-hidden.scss +12 -0
- package/dist/scss/spacers/_rules.scss +65 -0
- package/dist/scss/spacers/_variables.scss +19 -0
- package/dist/scss/typography/_box-shadow.scss +11 -0
- package/dist/scss/typography/_font-size.scss +81 -0
- package/dist/scss/typography/_letter-spacing.scss +15 -0
- package/dist/scss/typography/_main.scss +5 -0
- package/dist/scss/typography/_mixins.scss +26 -0
- package/dist/scss/typography/_rules.scss +83 -0
- package/dist/scss/typography/_text-shadow.scss +13 -0
- package/dist/scss/typography/_transform.scss +7 -0
- package/dist/scss/typography/_variables.scss +39 -0
- package/package.json +210 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
<script>/**
|
|
2
|
+
* ID of the scroller container
|
|
3
|
+
* @type {string}
|
|
4
|
+
*/
|
|
5
|
+
export let id = '';
|
|
6
|
+
/**
|
|
7
|
+
* An array of step objects that define the steps in your scroller.
|
|
8
|
+
*
|
|
9
|
+
* Each step object in the array can have:
|
|
10
|
+
*
|
|
11
|
+
* - `background` A background component **REQUIRED**
|
|
12
|
+
* - `backgroundProps` An object of props given to the background component
|
|
13
|
+
* - `foreground` Either a markdown-formatted string or a foreground component **REQUIRED**
|
|
14
|
+
* - `foregroundProps` An object of props given to the foreground component
|
|
15
|
+
*
|
|
16
|
+
* @required
|
|
17
|
+
*/
|
|
18
|
+
export let steps = [];
|
|
19
|
+
/**
|
|
20
|
+
* Width of the background
|
|
21
|
+
*/
|
|
22
|
+
export let backgroundWidth = 'fluid';
|
|
23
|
+
/**
|
|
24
|
+
* Position of the foreground. One of: middle, left, right, left opposite or right opposite.
|
|
25
|
+
*
|
|
26
|
+
* "opposite" options push the background to the other side on larger viewports.
|
|
27
|
+
*
|
|
28
|
+
* @type {string}
|
|
29
|
+
*/
|
|
30
|
+
export let foregroundPosition = 'middle';
|
|
31
|
+
/**
|
|
32
|
+
* Whether previous background steps should stack below the current one.
|
|
33
|
+
*
|
|
34
|
+
* - `true` _default_ Background graphics from previous steps will remain visible below the active one, allowing you to stack graphics with transparent backgrounds.
|
|
35
|
+
* - `false` Only the background graphic from the current step will show and backgrounds from previous steps are hidden.
|
|
36
|
+
*/
|
|
37
|
+
export let stackBackground = true;
|
|
38
|
+
/**
|
|
39
|
+
* How many background steps to load before and after the currently active one, effectively lazy-loading them.
|
|
40
|
+
*
|
|
41
|
+
* Setting to `0` disables lazy-loading and loads all backgrounds at once.
|
|
42
|
+
*/
|
|
43
|
+
export let preload = 1;
|
|
44
|
+
/**
|
|
45
|
+
* Setting to `true` will unroll the scroll experience into a flat layout.
|
|
46
|
+
*/
|
|
47
|
+
export let embedded = false;
|
|
48
|
+
/**
|
|
49
|
+
* Layout order when `embedded` is `true`.
|
|
50
|
+
*
|
|
51
|
+
* - `fb` _default_ Foreground then background
|
|
52
|
+
* - `bf` Background then foreground
|
|
53
|
+
*
|
|
54
|
+
* @type {string}
|
|
55
|
+
*/
|
|
56
|
+
export let embeddedLayout = 'fb';
|
|
57
|
+
/**
|
|
58
|
+
* Threshold prop passed to [svelte-scroller](https://github.com/sveltejs/svelte-scroller#parameters)
|
|
59
|
+
*/
|
|
60
|
+
export let threshold = 0.5;
|
|
61
|
+
/**
|
|
62
|
+
* Top prop passed to [svelte-scroller](https://github.com/sveltejs/svelte-scroller#parameters)
|
|
63
|
+
*/
|
|
64
|
+
export let top = 0;
|
|
65
|
+
/**
|
|
66
|
+
* Bottom prop passed to [svelte-scroller](https://github.com/sveltejs/svelte-scroller#parameters)
|
|
67
|
+
*/
|
|
68
|
+
export let bottom = 1;
|
|
69
|
+
/**
|
|
70
|
+
* Parallax prop passed to [svelte-scroller](https://github.com/sveltejs/svelte-scroller#parameters)
|
|
71
|
+
*/
|
|
72
|
+
export let parallax = false;
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
import SvelteScroller from '@sveltejs/svelte-scroller';
|
|
75
|
+
import Background from './Background.svelte';
|
|
76
|
+
import Foreground from './Foreground.svelte';
|
|
77
|
+
import Embedded from './Embedded/index.svelte';
|
|
78
|
+
import Block from '../Block/Block.svelte';
|
|
79
|
+
let index = 0;
|
|
80
|
+
let offset;
|
|
81
|
+
let progress;
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
{#if !embedded}
|
|
85
|
+
<Block width="fluid" cls="scroller-container" id="{id}">
|
|
86
|
+
<SvelteScroller
|
|
87
|
+
bind:index
|
|
88
|
+
bind:offset
|
|
89
|
+
bind:progress
|
|
90
|
+
threshold="{threshold}"
|
|
91
|
+
top="{top}"
|
|
92
|
+
bottom="{bottom}"
|
|
93
|
+
parallax="{parallax}"
|
|
94
|
+
query="div.step-foreground-container"
|
|
95
|
+
>
|
|
96
|
+
<div
|
|
97
|
+
slot="background"
|
|
98
|
+
class="background"
|
|
99
|
+
class:right="{foregroundPosition === 'left opposite'}"
|
|
100
|
+
class:left="{foregroundPosition === 'right opposite'}"
|
|
101
|
+
>
|
|
102
|
+
<div class="scroller-graphic-well">
|
|
103
|
+
<Block
|
|
104
|
+
width={backgroundWidth}
|
|
105
|
+
cls="background-container step-{index + 1}"
|
|
106
|
+
>
|
|
107
|
+
<Background
|
|
108
|
+
index="{index}"
|
|
109
|
+
steps="{steps}"
|
|
110
|
+
preload="{preload}"
|
|
111
|
+
stackBackground="{stackBackground}"
|
|
112
|
+
/>
|
|
113
|
+
</Block>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<div slot="foreground" class="foreground {foregroundPosition}">
|
|
118
|
+
<Foreground steps="{steps}" />
|
|
119
|
+
</div>
|
|
120
|
+
</SvelteScroller>
|
|
121
|
+
</Block>
|
|
122
|
+
{:else}
|
|
123
|
+
<Block width="widest" cls="scroller-container embedded" id="{id}">
|
|
124
|
+
<Embedded
|
|
125
|
+
steps="{steps}"
|
|
126
|
+
embeddedLayout="{embeddedLayout}"
|
|
127
|
+
backgroundWidth="{backgroundWidth}"
|
|
128
|
+
/>
|
|
129
|
+
</Block>
|
|
130
|
+
{/if}
|
|
131
|
+
|
|
132
|
+
<style>.scroller-container {
|
|
133
|
+
width: calc(100% + 30px);
|
|
134
|
+
margin-left: -15px;
|
|
135
|
+
max-width: initial;
|
|
136
|
+
}
|
|
137
|
+
.scroller-container.embedded {
|
|
138
|
+
width: 100%;
|
|
139
|
+
padding: 0 15px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
div.background {
|
|
143
|
+
min-height: 100vh;
|
|
144
|
+
position: relative;
|
|
145
|
+
padding: 0;
|
|
146
|
+
display: flex;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
}
|
|
149
|
+
div.background.left {
|
|
150
|
+
width: 50%;
|
|
151
|
+
float: left;
|
|
152
|
+
}
|
|
153
|
+
@media (max-width: 1200px) {
|
|
154
|
+
div.background.left {
|
|
155
|
+
justify-content: center;
|
|
156
|
+
width: 100%;
|
|
157
|
+
float: initial;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
div.background.right {
|
|
161
|
+
width: 50%;
|
|
162
|
+
float: right;
|
|
163
|
+
}
|
|
164
|
+
@media (max-width: 1200px) {
|
|
165
|
+
div.background.right {
|
|
166
|
+
justify-content: center;
|
|
167
|
+
width: 100%;
|
|
168
|
+
float: initial;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
div.background div.scroller-graphic-well {
|
|
172
|
+
padding: 0 15px;
|
|
173
|
+
width: 100%;
|
|
174
|
+
}
|
|
175
|
+
div.background div.scroller-graphic-well :global(div.background-container) {
|
|
176
|
+
margin-top: 0;
|
|
177
|
+
margin-bottom: 0;
|
|
178
|
+
min-height: 100vh;
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
align-items: center;
|
|
182
|
+
position: relative;
|
|
183
|
+
}
|
|
184
|
+
div.background div.scroller-graphic-well :global(div.background-container.fluid) {
|
|
185
|
+
margin: 0 0 0 -15px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
div.foreground {
|
|
189
|
+
width: 100%;
|
|
190
|
+
}
|
|
191
|
+
div.foreground.right {
|
|
192
|
+
width: 50%;
|
|
193
|
+
float: right;
|
|
194
|
+
}
|
|
195
|
+
@media (max-width: 1200px) {
|
|
196
|
+
div.foreground.right {
|
|
197
|
+
width: 100%;
|
|
198
|
+
float: initial;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
div.foreground.left {
|
|
202
|
+
width: 50%;
|
|
203
|
+
float: left;
|
|
204
|
+
}
|
|
205
|
+
@media (max-width: 1200px) {
|
|
206
|
+
div.foreground.left {
|
|
207
|
+
width: 100%;
|
|
208
|
+
float: initial;
|
|
209
|
+
}
|
|
210
|
+
}</style>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Fa from 'svelte-fa/src/fa.svelte';
|
|
3
|
+
import { faShareAlt } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
+
import { faTwitter } from '@fortawesome/free-brands-svg-icons';
|
|
5
|
+
import { faFacebookF } from '@fortawesome/free-brands-svg-icons';
|
|
6
|
+
import { throttle } from 'lodash-es';
|
|
7
|
+
import handleTweet from './utils/twitter';
|
|
8
|
+
import handlePost from './utils/facebook';
|
|
9
|
+
import UAParser from 'ua-parser-js';
|
|
10
|
+
import { onMount } from 'svelte';
|
|
11
|
+
|
|
12
|
+
const uaParser = new UAParser();
|
|
13
|
+
|
|
14
|
+
const getMetaContent = (property) => {
|
|
15
|
+
const el = document.querySelector(`meta[property="${property}"]`);
|
|
16
|
+
if (el) return el.getAttribute('content');
|
|
17
|
+
return '';
|
|
18
|
+
};
|
|
19
|
+
const handleShare = async function() {
|
|
20
|
+
if (showSecondaryDialogue) {
|
|
21
|
+
showSecondaryDialogue = false;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (
|
|
25
|
+
navigator &&
|
|
26
|
+
navigator.share &&
|
|
27
|
+
uaParser.getBrowser().name !== 'Safari'
|
|
28
|
+
) {
|
|
29
|
+
try {
|
|
30
|
+
await navigator.share({
|
|
31
|
+
title: getMetaContent('og:title'),
|
|
32
|
+
text: getMetaContent('og:description'),
|
|
33
|
+
url: window.location.href,
|
|
34
|
+
});
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.log('Share error', err);
|
|
37
|
+
}
|
|
38
|
+
// Otherwise copy URL to a clipboard
|
|
39
|
+
} else {
|
|
40
|
+
showSecondaryDialogue = true;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
let lastScroll = 0;
|
|
44
|
+
let showShare = false;
|
|
45
|
+
let showSecondaryDialogue = false;
|
|
46
|
+
function handleScroll() {
|
|
47
|
+
if (lastScroll > window.scrollY) {
|
|
48
|
+
if (!showShare) {
|
|
49
|
+
showShare = true;
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
if (showShare) {
|
|
53
|
+
if (showSecondaryDialogue) {
|
|
54
|
+
showSecondaryDialogue = false;
|
|
55
|
+
} else {
|
|
56
|
+
showShare = false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
lastScroll = window.scrollY;
|
|
61
|
+
}
|
|
62
|
+
onMount(() => {
|
|
63
|
+
window.addEventListener('scroll', throttle(handleScroll, 250));
|
|
64
|
+
});
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
<div class="sharetool" class:active={showShare}>
|
|
69
|
+
<div class="drawer" class:active={showSecondaryDialogue }>
|
|
70
|
+
<button
|
|
71
|
+
on:click={handleShare}
|
|
72
|
+
title="Share this!"
|
|
73
|
+
disabled={showSecondaryDialogue}
|
|
74
|
+
class='box-shadow-low'
|
|
75
|
+
>
|
|
76
|
+
<div><Fa fw icon={faShareAlt} /></div>
|
|
77
|
+
</button>
|
|
78
|
+
<button on:click={handleTweet} title="Twitter">
|
|
79
|
+
<div><Fa fw icon={faTwitter} /></div>
|
|
80
|
+
</button>
|
|
81
|
+
<button on:click={handlePost} title="Facebook">
|
|
82
|
+
<div><Fa fw icon={faFacebookF} /></div>
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
<style>.sharetool.active {
|
|
89
|
+
bottom: 10px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.sharetool {
|
|
93
|
+
position: fixed;
|
|
94
|
+
bottom: -5rem;
|
|
95
|
+
right: 10px;
|
|
96
|
+
transition: all 0.2s;
|
|
97
|
+
z-index: 9999;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.sharetool button {
|
|
101
|
+
background: #333;
|
|
102
|
+
color: white;
|
|
103
|
+
border: 1px solid white;
|
|
104
|
+
border-radius: 50%;
|
|
105
|
+
font-size: 1.25rem;
|
|
106
|
+
text-align: center;
|
|
107
|
+
height: 2.25rem;
|
|
108
|
+
width: 2.25rem;
|
|
109
|
+
outline: none !important;
|
|
110
|
+
transition: color 0.2s;
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
}
|
|
113
|
+
.sharetool button div {
|
|
114
|
+
width: 100%;
|
|
115
|
+
height: 100%;
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.sharetool button:active {
|
|
122
|
+
transform: translate(1px, 1px);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.sharetool button:disabled {
|
|
126
|
+
background: white;
|
|
127
|
+
color: #ddd;
|
|
128
|
+
cursor: default;
|
|
129
|
+
box-shadow: none;
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.drawer {
|
|
134
|
+
width: calc(2.25rem + 4px);
|
|
135
|
+
overflow-x: hidden;
|
|
136
|
+
transition: width 0.2s;
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
padding: 2px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.drawer.active {
|
|
142
|
+
width: calc(7.25rem + 4px);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@media only screen and (max-width: 600px) {
|
|
146
|
+
.sharetool button {
|
|
147
|
+
font-size: 1.75rem;
|
|
148
|
+
height: 3rem;
|
|
149
|
+
width: 3rem;
|
|
150
|
+
}
|
|
151
|
+
.drawer {
|
|
152
|
+
width: calc(3rem + 4px);
|
|
153
|
+
}
|
|
154
|
+
.drawer.active {
|
|
155
|
+
width: calc(9.5rem + 4px);
|
|
156
|
+
}
|
|
157
|
+
}</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getHref } from './meta';
|
|
2
|
+
|
|
3
|
+
const handlePost = () => {
|
|
4
|
+
const windowOptions = 'scrollbars=yes,resizable=yes,toolbar=no,location=yes';
|
|
5
|
+
const width = 550;
|
|
6
|
+
const height = 420;
|
|
7
|
+
const winHeight = screen.height;
|
|
8
|
+
const winWidth = screen.width;
|
|
9
|
+
|
|
10
|
+
const left = Math.round(winWidth / 2 - width / 2);
|
|
11
|
+
const top = winHeight > height ? Math.round(winHeight / 2 - height / 2) : 0;
|
|
12
|
+
|
|
13
|
+
const target = `https://www.facebook.com/sharer/sharer.php?u=${getHref()}`;
|
|
14
|
+
|
|
15
|
+
window.open(
|
|
16
|
+
target,
|
|
17
|
+
'intent',
|
|
18
|
+
`${windowOptions},width=${width},height=${height},left=${left},top=${top}`
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default handlePost;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const getTitle = () => {
|
|
2
|
+
const ogTag = document.querySelector("meta[property='og:title']");
|
|
3
|
+
if (ogTag) return encodeURIComponent(ogTag.getAttribute('content'));
|
|
4
|
+
return encodeURIComponent(document.title);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const getHref = () => encodeURIComponent(window.location.href);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getHref, getTitle } from './meta';
|
|
2
|
+
|
|
3
|
+
const handleTweet = () => {
|
|
4
|
+
const windowOptions = 'scrollbars=yes,resizable=yes,toolbar=no,location=yes';
|
|
5
|
+
const width = 550;
|
|
6
|
+
const height = 420;
|
|
7
|
+
const winHeight = screen.height;
|
|
8
|
+
const winWidth = screen.width;
|
|
9
|
+
|
|
10
|
+
const left = Math.round(winWidth / 2 - width / 2);
|
|
11
|
+
const top = winHeight > height ? Math.round(winHeight / 2 - height / 2) : 0;
|
|
12
|
+
|
|
13
|
+
const target = `https://twitter.com/intent/tweet?text=${getTitle()}&via=Reuters&url=${getHref()}`;
|
|
14
|
+
|
|
15
|
+
window.open(
|
|
16
|
+
target,
|
|
17
|
+
'intent',
|
|
18
|
+
`${windowOptions},width=${width},height=${height},left=${left},top=${top}`
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default handleTweet;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Twitter from './svgs/Twitter.svelte';
|
|
3
|
+
import YouTube from './svgs/YouTube.svelte';
|
|
4
|
+
import Facebook from './svgs/Facebook.svelte';
|
|
5
|
+
import Instagram from './svgs/Instagram.svelte';
|
|
6
|
+
import LinkedIn from './svgs/LinkedIn.svelte';
|
|
7
|
+
import { normalizeUrl } from '../SiteHeader/NavBar/utils';
|
|
8
|
+
|
|
9
|
+
const symbols = {
|
|
10
|
+
twitter: Twitter,
|
|
11
|
+
facebook: Facebook,
|
|
12
|
+
instagram: Instagram,
|
|
13
|
+
youtube: YouTube,
|
|
14
|
+
linkedin: LinkedIn,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export let links = {};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{#if links.social_links}
|
|
21
|
+
<section class="company">
|
|
22
|
+
<div class="content-container">
|
|
23
|
+
<article class="company-info">
|
|
24
|
+
<h2>Information you can trust</h2>
|
|
25
|
+
<p>{links.company_description}</p>
|
|
26
|
+
</article>
|
|
27
|
+
<div class="social">
|
|
28
|
+
<h2>Follow Us</h2>
|
|
29
|
+
<div>
|
|
30
|
+
<ul class="links">
|
|
31
|
+
{#each links.social_links as link}
|
|
32
|
+
<li class="social-links symbol">
|
|
33
|
+
<a href="{normalizeUrl(link.url)}">
|
|
34
|
+
<div class="button">
|
|
35
|
+
<div class="social">
|
|
36
|
+
<svelte:component this="{symbols[link.type]}" />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</a>
|
|
40
|
+
</li>
|
|
41
|
+
{/each}
|
|
42
|
+
</ul>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</section>
|
|
47
|
+
{/if}
|
|
48
|
+
|
|
49
|
+
<style>.content-container {
|
|
50
|
+
max-width: 1440px;
|
|
51
|
+
width: 100%;
|
|
52
|
+
margin: 0 auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.company {
|
|
56
|
+
padding-top: 24px;
|
|
57
|
+
padding-bottom: 24px;
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
}
|
|
60
|
+
.company .content-container {
|
|
61
|
+
display: grid;
|
|
62
|
+
grid-template-columns: repeat(12, 1fr);
|
|
63
|
+
grid-column-gap: 2.2222222222vw;
|
|
64
|
+
}
|
|
65
|
+
@media (max-width: 1023px) {
|
|
66
|
+
.company .content-container {
|
|
67
|
+
grid-column-gap: 4.2666666667vw;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
@media (min-width: 1440px) {
|
|
71
|
+
.company .content-container {
|
|
72
|
+
grid-column-gap: 32px;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
@media (max-width: 1023px) {
|
|
76
|
+
.company .content-container {
|
|
77
|
+
grid-template-columns: repeat(4, 1fr);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.company {
|
|
82
|
+
border-top: 1px solid var(--nav-rules, #d0d0d0);
|
|
83
|
+
}
|
|
84
|
+
.company .content-container {
|
|
85
|
+
padding-left: 2.2222222222vw;
|
|
86
|
+
padding-right: 2.2222222222vw;
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
}
|
|
89
|
+
@media (max-width: 1023px) {
|
|
90
|
+
.company .content-container {
|
|
91
|
+
padding-left: 4.2666666667vw;
|
|
92
|
+
padding-right: 4.2666666667vw;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
@media (min-width: 1440px) {
|
|
96
|
+
.company .content-container {
|
|
97
|
+
padding-left: 32px;
|
|
98
|
+
padding-right: 32px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.company .content-container {
|
|
103
|
+
grid-row-gap: 24px;
|
|
104
|
+
}
|
|
105
|
+
.company .content-container .company-info {
|
|
106
|
+
grid-column: 1/span 5;
|
|
107
|
+
}
|
|
108
|
+
.company .content-container .social {
|
|
109
|
+
grid-column: 7/span 5;
|
|
110
|
+
}
|
|
111
|
+
@media (max-width: 1023px) {
|
|
112
|
+
.company .content-container .company-info,
|
|
113
|
+
.company .content-container .social {
|
|
114
|
+
grid-column: 1/span 4;
|
|
115
|
+
grid-row: auto;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.links {
|
|
120
|
+
padding: 0;
|
|
121
|
+
margin: 0;
|
|
122
|
+
}
|
|
123
|
+
.links .symbol .button {
|
|
124
|
+
border-radius: 8px;
|
|
125
|
+
border: 1px solid var(--nav-rules, #d0d0d0);
|
|
126
|
+
background: var(--nav-background, #fff);
|
|
127
|
+
color: var(--nav-primary, #666);
|
|
128
|
+
}
|
|
129
|
+
.links .symbol .button:hover {
|
|
130
|
+
border: 1px solid var(--nav-primary, #404040);
|
|
131
|
+
}
|
|
132
|
+
.links .social {
|
|
133
|
+
width: 40px;
|
|
134
|
+
height: 40px;
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
align-items: center;
|
|
138
|
+
color: inherit;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.symbol {
|
|
142
|
+
list-style: none;
|
|
143
|
+
display: inline-block;
|
|
144
|
+
vertical-align: middle;
|
|
145
|
+
margin-left: 16px;
|
|
146
|
+
}
|
|
147
|
+
.symbol:first-child {
|
|
148
|
+
margin-left: 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
section.company {
|
|
152
|
+
max-width: 100%;
|
|
153
|
+
}
|
|
154
|
+
section.company h2 {
|
|
155
|
+
margin-bottom: 12px;
|
|
156
|
+
line-height: 1.333;
|
|
157
|
+
font-size: 16px;
|
|
158
|
+
color: var(--nav-primary, #404040);
|
|
159
|
+
font-weight: 400;
|
|
160
|
+
-webkit-font-smoothing: antialiased;
|
|
161
|
+
}
|
|
162
|
+
@media (min-width: 1300px) {
|
|
163
|
+
section.company h2 {
|
|
164
|
+
font-size: 18px;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
section.company p {
|
|
168
|
+
font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
|
|
169
|
+
line-height: 1.43;
|
|
170
|
+
font-size: 14px;
|
|
171
|
+
color: var(--nav-primary, #404040);
|
|
172
|
+
font-weight: 400;
|
|
173
|
+
}</style>
|