@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,277 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { afterUpdate } from 'svelte';
|
|
3
|
+
import StoryCard from './StoryCard/index.svelte';
|
|
4
|
+
import Spinner from './Spinner/index.svelte';
|
|
5
|
+
import { getContext } from 'svelte';
|
|
6
|
+
|
|
7
|
+
const activeSection = getContext('nav-active-section');
|
|
8
|
+
|
|
9
|
+
export let headingText = 'Trending Stories';
|
|
10
|
+
|
|
11
|
+
let stories = [];
|
|
12
|
+
let lastFetched = null;
|
|
13
|
+
|
|
14
|
+
afterUpdate(async () => {
|
|
15
|
+
if (lastFetched === $activeSection) return;
|
|
16
|
+
if ($activeSection === 'more') {
|
|
17
|
+
await fetch(
|
|
18
|
+
'https://www.reuters.com/pf/api/v3/content/fetch/articles-by-trends-v1?' +
|
|
19
|
+
new URLSearchParams({
|
|
20
|
+
query: JSON.stringify({
|
|
21
|
+
size: 4,
|
|
22
|
+
website: 'reuters',
|
|
23
|
+
}),
|
|
24
|
+
})
|
|
25
|
+
)
|
|
26
|
+
.then((response) => response.json())
|
|
27
|
+
.then((data) => {
|
|
28
|
+
stories = data.result.articles;
|
|
29
|
+
lastFetched = $activeSection;
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
await fetch(
|
|
33
|
+
'https://www.reuters.com/pf/api/v3/content/fetch/recent-stories-by-sections-v1?' +
|
|
34
|
+
new URLSearchParams({
|
|
35
|
+
query: JSON.stringify({
|
|
36
|
+
section_ids: $activeSection,
|
|
37
|
+
size: 4,
|
|
38
|
+
website: 'reuters',
|
|
39
|
+
}),
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
.then((response) => response.json())
|
|
43
|
+
.then((data) => {
|
|
44
|
+
stories = data.result.articles;
|
|
45
|
+
lastFetched = $activeSection;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<div class="dropdown">
|
|
52
|
+
<div class="dropdown-container">
|
|
53
|
+
<div class="inner">
|
|
54
|
+
<div class="submenu">
|
|
55
|
+
<div class="inner">
|
|
56
|
+
<slot />
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="stories-container">
|
|
60
|
+
<div class="inner">
|
|
61
|
+
{#if stories.length > 0}
|
|
62
|
+
<span class="latest">{headingText}</span>
|
|
63
|
+
<ul class="story-list">
|
|
64
|
+
{#each stories as story}
|
|
65
|
+
<li class="story-item">
|
|
66
|
+
<StoryCard
|
|
67
|
+
story="{story}"
|
|
68
|
+
withSection="{$activeSection === 'more'}"
|
|
69
|
+
/>
|
|
70
|
+
</li>
|
|
71
|
+
{/each}
|
|
72
|
+
</ul>
|
|
73
|
+
{:else}
|
|
74
|
+
<div class="spinner">
|
|
75
|
+
<Spinner />
|
|
76
|
+
</div>
|
|
77
|
+
{/if}
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<style>@charset "UTF-8";
|
|
85
|
+
/*
|
|
86
|
+
Several components utilize z-index, the CSS property that helps control layout by providing a third axis to arrange content. We utilize a default z-index scale that’s been designed to properly layer navigation, tooltips and popovers, modals, and more.
|
|
87
|
+
These higher values start at an arbitrary number, high and specific enough to ideally avoid conflicts. We need a standard set of these across our layered components—tooltips, popovers, navbars, dropdowns, modals—so we can be reasonably consistent in the behaviors.
|
|
88
|
+
To handle overlapping borders within components (e.g., buttons and inputs in input groups), we use low single digit z-index values of 1, 2, and 3 for default, hover, and active states. On hover/focus/active, we bring a particular element to the forefront with a higher z-index value to show their border over the sibling elements.
|
|
89
|
+
*/
|
|
90
|
+
.dropdown {
|
|
91
|
+
position: absolute;
|
|
92
|
+
z-index: 1000;
|
|
93
|
+
left: 0;
|
|
94
|
+
top: 64px;
|
|
95
|
+
width: 100%;
|
|
96
|
+
}
|
|
97
|
+
@media (max-width: 745px) {
|
|
98
|
+
.dropdown {
|
|
99
|
+
top: 56px;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.dropdown-container {
|
|
104
|
+
border-top: 1px solid var(--nav-rules, #d0d0d0);
|
|
105
|
+
box-shadow: 0 10px 16px rgba(0, 0, 0, 0.1);
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
background: var(--nav-background, #fff);
|
|
108
|
+
}
|
|
109
|
+
.dropdown-container > .inner {
|
|
110
|
+
display: grid;
|
|
111
|
+
grid-template-columns: repeat(12, 1fr);
|
|
112
|
+
grid-column-gap: 2.2222222222vw;
|
|
113
|
+
padding-left: 2.2222222222vw;
|
|
114
|
+
padding-right: 2.2222222222vw;
|
|
115
|
+
max-width: 1440px;
|
|
116
|
+
margin: 0 auto;
|
|
117
|
+
}
|
|
118
|
+
@media (max-width: 1023px) {
|
|
119
|
+
.dropdown-container > .inner {
|
|
120
|
+
grid-column-gap: 4.2666666667vw;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
@media (min-width: 1440px) {
|
|
124
|
+
.dropdown-container > .inner {
|
|
125
|
+
grid-column-gap: 32px;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
@media (max-width: 1023px) {
|
|
129
|
+
.dropdown-container > .inner {
|
|
130
|
+
grid-template-columns: repeat(4, 1fr);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
@media (max-width: 1023px) {
|
|
134
|
+
.dropdown-container > .inner {
|
|
135
|
+
padding-left: 4.2666666667vw;
|
|
136
|
+
padding-right: 4.2666666667vw;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
@media (min-width: 1440px) {
|
|
140
|
+
.dropdown-container > .inner {
|
|
141
|
+
padding-left: 32px;
|
|
142
|
+
padding-right: 32px;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.submenu,
|
|
147
|
+
.stories-container {
|
|
148
|
+
padding: 24px 0;
|
|
149
|
+
grid-row: 1;
|
|
150
|
+
}
|
|
151
|
+
.submenu .inner,
|
|
152
|
+
.stories-container .inner {
|
|
153
|
+
position: relative;
|
|
154
|
+
height: 100%;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.submenu {
|
|
158
|
+
grid-column: 1/span 4;
|
|
159
|
+
}
|
|
160
|
+
@media (min-width: 1440px) {
|
|
161
|
+
.submenu {
|
|
162
|
+
grid-column: 2/span 3;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
@media (max-width: 1023px) {
|
|
166
|
+
.submenu {
|
|
167
|
+
grid-column: 1/span 2;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.stories-container {
|
|
172
|
+
grid-column: 5/span 8;
|
|
173
|
+
min-height: 300px;
|
|
174
|
+
}
|
|
175
|
+
.stories-container .inner {
|
|
176
|
+
padding-left: 2.2222222222vw;
|
|
177
|
+
border-left: 1px solid var(--nav-rules, #d0d0d0);
|
|
178
|
+
}
|
|
179
|
+
@media (max-width: 1023px) {
|
|
180
|
+
.stories-container .inner {
|
|
181
|
+
padding-left: 4.2666666667vw;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
@media (min-width: 1440px) {
|
|
185
|
+
.stories-container .inner {
|
|
186
|
+
padding-left: 32px;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
@media (min-width: 1440px) {
|
|
190
|
+
.stories-container {
|
|
191
|
+
grid-column: 5/span 7;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
@media (max-width: 1023px) {
|
|
195
|
+
.stories-container {
|
|
196
|
+
grid-column: 3/span 2;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.story-list {
|
|
201
|
+
display: grid;
|
|
202
|
+
grid-template-columns: repeat(2, 1fr);
|
|
203
|
+
grid-column-gap: 2.2222222222vw;
|
|
204
|
+
list-style: none;
|
|
205
|
+
padding: 0;
|
|
206
|
+
margin: 20px 0 0 0;
|
|
207
|
+
}
|
|
208
|
+
@media (max-width: 1023px) {
|
|
209
|
+
.story-list {
|
|
210
|
+
grid-column-gap: 4.2666666667vw;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
@media (min-width: 1440px) {
|
|
214
|
+
.story-list {
|
|
215
|
+
grid-column-gap: 32px;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
@media (max-width: 1023px) {
|
|
219
|
+
.story-list {
|
|
220
|
+
grid-template-columns: repeat(1, 1fr);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.story-item {
|
|
225
|
+
padding-bottom: 20px;
|
|
226
|
+
-webkit-animation: fadein 0.5s both cubic-bezier(0.19, 1, 0.22, 1);
|
|
227
|
+
animation: fadein 0.5s both cubic-bezier(0.19, 1, 0.22, 1);
|
|
228
|
+
}
|
|
229
|
+
.story-item:nth-child(1), .story-item:nth-child(2) {
|
|
230
|
+
border-bottom: 1px solid var(--nav-rules, #d0d0d0);
|
|
231
|
+
}
|
|
232
|
+
.story-item:nth-child(3), .story-item:nth-child(4) {
|
|
233
|
+
padding-top: 20px;
|
|
234
|
+
}
|
|
235
|
+
@media (max-width: 1023px) {
|
|
236
|
+
.story-item:nth-child(2) {
|
|
237
|
+
padding-top: 20px;
|
|
238
|
+
}
|
|
239
|
+
.story-item:nth-child(3) {
|
|
240
|
+
border-bottom: 1px solid var(--nav-rules, #d0d0d0);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.spinner {
|
|
245
|
+
width: 40px;
|
|
246
|
+
margin-left: -20px;
|
|
247
|
+
position: absolute;
|
|
248
|
+
top: 60px;
|
|
249
|
+
left: 50%;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
@-webkit-keyframes fadein {
|
|
253
|
+
from {
|
|
254
|
+
opacity: 0;
|
|
255
|
+
}
|
|
256
|
+
to {
|
|
257
|
+
opacity: 1;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@keyframes fadein {
|
|
262
|
+
from {
|
|
263
|
+
opacity: 0;
|
|
264
|
+
}
|
|
265
|
+
to {
|
|
266
|
+
opacity: 1;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
span.latest {
|
|
270
|
+
font-size: 16px;
|
|
271
|
+
color: var(--nav-primary, #404040);
|
|
272
|
+
}
|
|
273
|
+
@media (min-width: 1300px) {
|
|
274
|
+
span.latest {
|
|
275
|
+
font-size: 18px;
|
|
276
|
+
}
|
|
277
|
+
}</style>
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import DownArrow from './DownArrow.svelte';
|
|
3
|
+
import SectionDropdown from './NavDropdown/SectionDropdown.svelte';
|
|
4
|
+
import MoreDropdown from './NavDropdown/MoreDropdown.svelte';
|
|
5
|
+
import { normalizeUrl } from './utils/index';
|
|
6
|
+
import { getContext } from 'svelte';
|
|
7
|
+
|
|
8
|
+
export let sections = [];
|
|
9
|
+
|
|
10
|
+
const activeSection = getContext('nav-active-section');
|
|
11
|
+
|
|
12
|
+
let windowWidth = 1200;
|
|
13
|
+
|
|
14
|
+
$: getDisplayCount = () => {
|
|
15
|
+
if (windowWidth >= 1300) return 7;
|
|
16
|
+
return 5;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
let navTimeout;
|
|
20
|
+
const timeout = 250;
|
|
21
|
+
|
|
22
|
+
$: displayCount = getDisplayCount();
|
|
23
|
+
$: displaySections = sections.slice(0, displayCount);
|
|
24
|
+
$: hiddenSections = sections.slice(displayCount);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<svelte:window bind:innerWidth="{windowWidth}" />
|
|
28
|
+
|
|
29
|
+
<div class="nav-bar">
|
|
30
|
+
<nav aria-label="Main navigation">
|
|
31
|
+
<ul class="nav-list">
|
|
32
|
+
{#each displaySections as section}
|
|
33
|
+
{#if section.children}
|
|
34
|
+
<li
|
|
35
|
+
class="nav-item category link"
|
|
36
|
+
on:mouseenter="{() => {
|
|
37
|
+
navTimeout = setTimeout(
|
|
38
|
+
() => activeSection.set(section.id),
|
|
39
|
+
timeout
|
|
40
|
+
);
|
|
41
|
+
}}"
|
|
42
|
+
on:focus="{() => activeSection.set(section.id)}"
|
|
43
|
+
on:mouseleave="{() => {
|
|
44
|
+
clearTimeout(navTimeout);
|
|
45
|
+
activeSection.set(null);
|
|
46
|
+
}}"
|
|
47
|
+
on:blur="{() => {
|
|
48
|
+
clearTimeout(navTimeout);
|
|
49
|
+
activeSection.set(null);
|
|
50
|
+
}}"
|
|
51
|
+
on:click="{() => {
|
|
52
|
+
if ($activeSection === section.id) {
|
|
53
|
+
clearTimeout(navTimeout);
|
|
54
|
+
activeSection.set(null);
|
|
55
|
+
}
|
|
56
|
+
}}"
|
|
57
|
+
>
|
|
58
|
+
<div
|
|
59
|
+
class="nav-button link"
|
|
60
|
+
class:open="{section.id === $activeSection}"
|
|
61
|
+
>
|
|
62
|
+
<a href="{normalizeUrl(section.url)}">
|
|
63
|
+
{section.name}
|
|
64
|
+
</a>
|
|
65
|
+
<button class="button">
|
|
66
|
+
<DownArrow rotate="{section.id === $activeSection}" />
|
|
67
|
+
</button>
|
|
68
|
+
</div>
|
|
69
|
+
{#if $activeSection === section.id}
|
|
70
|
+
<SectionDropdown
|
|
71
|
+
section="{section}"
|
|
72
|
+
headingText="{`Latest in ${section.name}`}"
|
|
73
|
+
/>
|
|
74
|
+
{/if}
|
|
75
|
+
</li>
|
|
76
|
+
{:else}
|
|
77
|
+
<li class="nav-item category link">
|
|
78
|
+
<div class="nav-button link">
|
|
79
|
+
<a href="{normalizeUrl(section.url)}">
|
|
80
|
+
{section.name}
|
|
81
|
+
</a>
|
|
82
|
+
</div>
|
|
83
|
+
</li>
|
|
84
|
+
{/if}
|
|
85
|
+
{/each}
|
|
86
|
+
<li
|
|
87
|
+
class="nav-item"
|
|
88
|
+
on:mouseenter="{() => {
|
|
89
|
+
navTimeout = setTimeout(() => activeSection.set('more'), timeout);
|
|
90
|
+
}}"
|
|
91
|
+
on:focus="{() => activeSection.set('more')}"
|
|
92
|
+
on:mouseleave="{() => {
|
|
93
|
+
clearTimeout(navTimeout);
|
|
94
|
+
activeSection.set(null);
|
|
95
|
+
}}"
|
|
96
|
+
on:blur="{() => {
|
|
97
|
+
clearTimeout(navTimeout);
|
|
98
|
+
activeSection.set(null);
|
|
99
|
+
}}"
|
|
100
|
+
on:click="{() => {
|
|
101
|
+
if ($activeSection === 'more') {
|
|
102
|
+
clearTimeout(navTimeout);
|
|
103
|
+
activeSection.set(null);
|
|
104
|
+
}
|
|
105
|
+
}}"
|
|
106
|
+
>
|
|
107
|
+
<div
|
|
108
|
+
class="nav-button more link"
|
|
109
|
+
class:open="{$activeSection === 'more'}"
|
|
110
|
+
>
|
|
111
|
+
<button class="button">
|
|
112
|
+
<span>More <DownArrow rotate="{$activeSection === 'more'}" /></span>
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
{#if $activeSection === 'more'}
|
|
116
|
+
<MoreDropdown sections="{hiddenSections}" />
|
|
117
|
+
{/if}
|
|
118
|
+
</li>
|
|
119
|
+
</ul>
|
|
120
|
+
</nav>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<style>@charset "UTF-8";
|
|
124
|
+
/*
|
|
125
|
+
Several components utilize z-index, the CSS property that helps control layout by providing a third axis to arrange content. We utilize a default z-index scale that’s been designed to properly layer navigation, tooltips and popovers, modals, and more.
|
|
126
|
+
These higher values start at an arbitrary number, high and specific enough to ideally avoid conflicts. We need a standard set of these across our layered components—tooltips, popovers, navbars, dropdowns, modals—so we can be reasonably consistent in the behaviors.
|
|
127
|
+
To handle overlapping borders within components (e.g., buttons and inputs in input groups), we use low single digit z-index values of 1, 2, and 3 for default, hover, and active states. On hover/focus/active, we bring a particular element to the forefront with a higher z-index value to show their border over the sibling elements.
|
|
128
|
+
*/
|
|
129
|
+
.nav-bar {
|
|
130
|
+
margin-left: auto;
|
|
131
|
+
}
|
|
132
|
+
@media (max-width: 745px) {
|
|
133
|
+
.nav-bar {
|
|
134
|
+
display: none;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.nav-list {
|
|
139
|
+
list-style: none;
|
|
140
|
+
margin: 0;
|
|
141
|
+
padding: 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.nav-item {
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
padding: 0 10px;
|
|
147
|
+
font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
|
|
148
|
+
font-weight: 500;
|
|
149
|
+
font-size: 16px;
|
|
150
|
+
}
|
|
151
|
+
.nav-item .nav-button {
|
|
152
|
+
position: relative;
|
|
153
|
+
height: 64px;
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
}
|
|
158
|
+
.nav-item .nav-button a,
|
|
159
|
+
.nav-item .nav-button span {
|
|
160
|
+
color: var(--nav-primary, #404040);
|
|
161
|
+
text-decoration: none;
|
|
162
|
+
}
|
|
163
|
+
.nav-item .nav-button a:hover, .nav-item .nav-button a:active,
|
|
164
|
+
.nav-item .nav-button span:hover,
|
|
165
|
+
.nav-item .nav-button span:active {
|
|
166
|
+
text-decoration: none;
|
|
167
|
+
}
|
|
168
|
+
@media (max-width: 745px) {
|
|
169
|
+
.nav-item .nav-button {
|
|
170
|
+
height: 56px;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
.nav-item .nav-button.open:after {
|
|
174
|
+
content: "";
|
|
175
|
+
position: absolute;
|
|
176
|
+
left: 0;
|
|
177
|
+
right: 0;
|
|
178
|
+
bottom: 0;
|
|
179
|
+
display: block;
|
|
180
|
+
height: 4px;
|
|
181
|
+
background: var(--nav-accent, #fa6400);
|
|
182
|
+
opacity: 1 !important;
|
|
183
|
+
}
|
|
184
|
+
.nav-item .link {
|
|
185
|
+
position: relative;
|
|
186
|
+
line-height: 64px;
|
|
187
|
+
}
|
|
188
|
+
.nav-item .link:hover:after {
|
|
189
|
+
content: "";
|
|
190
|
+
position: absolute;
|
|
191
|
+
left: 0;
|
|
192
|
+
right: 0;
|
|
193
|
+
bottom: 0;
|
|
194
|
+
display: block;
|
|
195
|
+
height: 4px;
|
|
196
|
+
background: var(--nav-accent, #fa6400);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.button {
|
|
200
|
+
margin: 0;
|
|
201
|
+
padding: 0;
|
|
202
|
+
border: none;
|
|
203
|
+
background-color: unset;
|
|
204
|
+
-webkit-appearance: none;
|
|
205
|
+
-moz-appearance: none;
|
|
206
|
+
appearance: none;
|
|
207
|
+
cursor: pointer;
|
|
208
|
+
font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
|
|
209
|
+
font-weight: 500;
|
|
210
|
+
font-size: 16px;
|
|
211
|
+
color: var(--nav-primary, #404040);
|
|
212
|
+
}
|
|
213
|
+
.button:not(.focused) {
|
|
214
|
+
outline: none;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.category {
|
|
218
|
+
display: none;
|
|
219
|
+
}
|
|
220
|
+
@media (max-width: 1023px) {
|
|
221
|
+
.category:nth-child(-n+4) {
|
|
222
|
+
display: inline-flex;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
@media (min-width: 1024px) {
|
|
226
|
+
.category:nth-child(-n+5) {
|
|
227
|
+
display: inline-flex;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
@media (min-width: 1300px) {
|
|
231
|
+
.category:nth-child(-n+7) {
|
|
232
|
+
display: inline-flex;
|
|
233
|
+
}
|
|
234
|
+
}</style>
|