@repobit/dex-system-design 2.2.1 → 2.3.0
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/CHANGELOG.md +15 -0
- package/package.json +12 -2
- package/schemas/component-manifest.json +816 -1
- package/src/assets/images/ai/bento-consumer-art.jpg +0 -0
- package/src/assets/images/ai/bento-enterprise-art.jpg +0 -0
- package/src/assets/images/ai/bento-labs-art.jpg +0 -0
- package/src/assets/images/award-marks/av-comparatives-top-rated.png +0 -0
- package/src/assets/images/award-marks/av-test-top-product.png +0 -0
- package/src/assets/images/award-marks/crn-partner-guide.png +0 -0
- package/src/assets/images/award-marks/forrester.png +0 -0
- package/src/assets/images/award-marks/gartner.png +0 -0
- package/src/assets/images/award-marks/idc.png +0 -0
- package/src/assets/images/award-marks/mitre-engenuity.png +0 -0
- package/src/assets/images/award-marks/omdia.png +0 -0
- package/src/assets/images/award-marks/pcmag-best-of-2026.png +0 -0
- package/src/assets/images/award-marks/pcmag-editors-choice.png +0 -0
- package/src/assets/images/award-marks/pcmag-readers-choice.png +0 -0
- package/src/assets/images/hero/ai-sphere-poster.jpg +0 -0
- package/src/assets/images/insights/post-1.jpg +0 -0
- package/src/assets/images/insights/post-2.jpg +0 -0
- package/src/assets/images/insights/post-3.jpg +0 -0
- package/src/assets/images/partner/ferrari-lockup.png +0 -0
- package/src/assets/images/partner/ferrari-photo.jpg +0 -0
- package/src/assets/images/partners/ferrari.svg +6 -0
- package/src/assets/images/partners/konica-minolta.svg +12 -0
- package/src/assets/images/partners/logmein.svg +6 -0
- package/src/assets/images/partners/netgear.svg +10 -0
- package/src/assets/images/partners/sharp.svg +5 -0
- package/src/assets/images/partners/spurs.svg +33 -0
- package/src/components/accordion/accordion.css.js +1 -5
- package/src/components/audience-card/audience-card.css.js +87 -0
- package/src/components/audience-card/audience-card.js +80 -0
- package/src/components/audience-card/audience-card.stories.js +125 -0
- package/src/components/bento-grid/bento-grid.stories.js +77 -1
- package/src/components/bento-grid/bento-item.css.js +142 -2
- package/src/components/bento-grid/bento-item.js +65 -1
- package/src/components/hero/hero.css.js +260 -0
- package/src/components/hero/hero.js +168 -0
- package/src/components/hero/hero.stories.js +145 -0
- package/src/components/icons/enterprise-icon.js +19 -0
- package/src/components/icons/home-icon.js +19 -0
- package/src/components/icons/icons.js +5 -0
- package/src/components/icons/icons.stories.js +28 -2
- package/src/components/icons/pause-icon.js +20 -0
- package/src/components/icons/play-icon.js +19 -0
- package/src/components/icons/small-business-icon.js +19 -0
- package/src/components/logo-marquee/logo-marquee.css.js +88 -0
- package/src/components/logo-marquee/logo-marquee.js +135 -0
- package/src/components/logo-marquee/logo-marquee.stories.js +125 -0
- package/src/components/motion-art/motion-art.js +42 -0
- package/src/components/motion-art/motion-art.stories.js +98 -0
- package/src/components/partner-banner/partner-banner.css.js +162 -0
- package/src/components/partner-banner/partner-banner.js +68 -0
- package/src/components/partner-banner/partner-banner.stories.js +86 -0
- package/src/components/post-card/post-card.css.js +121 -0
- package/src/components/post-card/post-card.js +80 -0
- package/src/components/post-card/post-card.stories.js +79 -0
- package/src/components/section-header/section-header.css.js +89 -0
- package/src/components/section-header/section-header.js +79 -0
- package/src/components/section-header/section-header.stories.js +129 -0
- package/src/components/stat/stat-highlight.js +75 -0
- package/src/components/stat/stat-tile.js +43 -0
- package/src/components/stat/stat.css.js +111 -0
- package/src/components/stat/stat.js +2 -0
- package/src/components/stat/stat.stories.js +92 -0
- package/src/vendor/motion-art/README.md +27 -0
- package/src/vendor/motion-art/motion-art-element.js +116 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, unsafeCSS } from "lit";
|
|
2
|
-
import { below } from "../shared/token-scales.js";
|
|
2
|
+
import { above, below } from "../shared/token-scales.js";
|
|
3
3
|
|
|
4
4
|
export default css`
|
|
5
5
|
:host {
|
|
@@ -128,4 +128,144 @@ box-shadow: 0px 14px 40px #00000012;
|
|
|
128
128
|
padding: var(--card-padding-compact);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
|
|
132
|
+
/* === BRAND ===
|
|
133
|
+
The homepage AI cards, as the Figma 2026_splitter frames draw them. No
|
|
134
|
+
hover lift: the CTA is the card's one control, and a card that moves as a
|
|
135
|
+
whole promises a link it does not have.
|
|
136
|
+
|
|
137
|
+
Phone (below md): a column at the compact inset -- the copy, the art
|
|
138
|
+
whole in a square at the card's inner width, the CTA across the card --
|
|
139
|
+
24 apart, at the smaller corner. */
|
|
140
|
+
:host([tone="brand"]) .bd-bentoitem-box {
|
|
141
|
+
position: relative;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
gap: var(--spacing-24);
|
|
146
|
+
padding: var(--spacing-24);
|
|
147
|
+
background: var(--color-surface-brand);
|
|
148
|
+
border-radius: var(--shape-radius-2xl);
|
|
149
|
+
color: var(--color-brand-on-fill);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:host([tone="brand"]) .bd-bentoitem-box:hover {
|
|
153
|
+
transform: none;
|
|
154
|
+
box-shadow: none;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.bd-bentoitem-media {
|
|
158
|
+
position: relative;
|
|
159
|
+
/* the art is square; the phone frame draws its box 302 by 308 */
|
|
160
|
+
aspect-ratio: 1;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
border-radius: var(--shape-radius-xl);
|
|
163
|
+
/* slotted motion art sizes itself from the box */
|
|
164
|
+
container-type: size;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
::slotted([slot="media"]) {
|
|
168
|
+
display: block;
|
|
169
|
+
width: 100%;
|
|
170
|
+
height: 100%;
|
|
171
|
+
object-fit: cover;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* bd-motion-art is square and draws at its own width, so the box gives it
|
|
175
|
+
one: here the square box itself, the art whole. Margins, not a translate,
|
|
176
|
+
so it centres in RTL too. */
|
|
177
|
+
::slotted(bd-motion-art[slot="media"]) {
|
|
178
|
+
position: absolute;
|
|
179
|
+
inset-block-start: 50%;
|
|
180
|
+
inset-inline-start: 50%;
|
|
181
|
+
width: 100cqh;
|
|
182
|
+
height: auto;
|
|
183
|
+
margin-block-start: -50cqh;
|
|
184
|
+
margin-inline-start: -50cqh;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.bd-bentoitem-text {
|
|
188
|
+
display: flex;
|
|
189
|
+
flex-direction: column;
|
|
190
|
+
align-items: flex-start;
|
|
191
|
+
gap: var(--spacing-12);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.bd-bentoitem-brand-title {
|
|
195
|
+
margin: 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.bd-bentoitem-brand-body {
|
|
199
|
+
margin: 0;
|
|
200
|
+
font-family: var(--typography-body-regular-fontFamily);
|
|
201
|
+
font-size: var(--typography-body-regular-fontSize);
|
|
202
|
+
font-weight: var(--typography-body-regular-fontWeight);
|
|
203
|
+
line-height: var(--typography-body-regular-lineHeight);
|
|
204
|
+
letter-spacing: var(--typography-body-regular-letterSpacing);
|
|
205
|
+
color: var(--color-brand-on-fill);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* From md, tablet and desktop alike, the card is a row at the card inset:
|
|
209
|
+
the copy over the CTA in a 300 column on the near side, 24 apart and
|
|
210
|
+
centred down the card, and the art from the column's edge out to the
|
|
211
|
+
card's, bleeding through the inset. The featured card's column is a
|
|
212
|
+
share of the row instead. */
|
|
213
|
+
@media ${unsafeCSS(above("md"))} {
|
|
214
|
+
:host([tone="brand"]) .bd-bentoitem-box {
|
|
215
|
+
display: grid;
|
|
216
|
+
/* no token: the copy's measure, the 300 every frame gives it */
|
|
217
|
+
grid-template-columns: 300px minmax(0, 1fr);
|
|
218
|
+
grid-template-areas:
|
|
219
|
+
"text media"
|
|
220
|
+
"cta media";
|
|
221
|
+
align-content: center;
|
|
222
|
+
gap: var(--spacing-24) 0;
|
|
223
|
+
padding: var(--spacing-32);
|
|
224
|
+
border-radius: var(--shape-radius-3xl);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
:host([tone="brand"][priority="featured"]) .bd-bentoitem-box {
|
|
228
|
+
/* not the column: the copy keeps to the near half of a full-row card */
|
|
229
|
+
grid-template-columns: 42% minmax(0, 1fr);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.bd-bentoitem-text {
|
|
233
|
+
grid-area: text;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.bd-bentoitem-cta {
|
|
237
|
+
grid-area: cta;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.bd-bentoitem-media {
|
|
241
|
+
grid-area: media;
|
|
242
|
+
aspect-ratio: auto;
|
|
243
|
+
border-radius: var(--radius-none);
|
|
244
|
+
margin-block: calc(-1 * var(--spacing-32));
|
|
245
|
+
margin-inline-end: calc(-1 * var(--spacing-32));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* Beside the copy the art is larger than its box, as the frames draw it:
|
|
249
|
+
held against the copy, centred down the card, and running off the
|
|
250
|
+
card's outer edge and its top and bottom -- never off the side its
|
|
251
|
+
badges and pills face. 135% of the card's height is the tablet frame's
|
|
252
|
+
434 square on a 321 card; a box wider than that, the featured card's,
|
|
253
|
+
takes its own width. */
|
|
254
|
+
::slotted(bd-motion-art[slot="media"]) {
|
|
255
|
+
inset-inline-start: 0;
|
|
256
|
+
width: max(100cqw, 135cqh);
|
|
257
|
+
margin-block-start: calc(max(100cqw, 135cqh) / -2);
|
|
258
|
+
margin-inline-start: 0;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* From lg the desktop frame pairs the cards, and a half-width card's art
|
|
263
|
+
box is a tall strip: the art takes the card's height, so the stack and
|
|
264
|
+
the globe stay in the card beside their pills. */
|
|
265
|
+
@media ${unsafeCSS(above("lg"))} {
|
|
266
|
+
::slotted(bd-motion-art[slot="media"]) {
|
|
267
|
+
width: max(100cqw, 100cqh);
|
|
268
|
+
margin-block-start: calc(max(100cqw, 100cqh) / -2);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
`;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { LitElement, html } from "lit";
|
|
2
2
|
import { tokens } from "../../tokens/tokens.js";
|
|
3
|
+
import "../badge/badge.js";
|
|
3
4
|
import "../heading/heading.js";
|
|
4
5
|
import "../paragraph/paragraph.js";
|
|
6
|
+
import { below } from "../shared/token-scales.js";
|
|
5
7
|
import bentoItemCSS from "./bento-item.css.js";
|
|
6
8
|
|
|
7
9
|
class BentoItem extends LitElement {
|
|
@@ -12,7 +14,12 @@ class BentoItem extends LitElement {
|
|
|
12
14
|
priority : { type: String, reflect: true },
|
|
13
15
|
orientation: { type: String, attribute: "orientation" },
|
|
14
16
|
// "default" (neutral-25 fill) | "tint" (light blue fill) | "dark" (dark fill, light text)
|
|
15
|
-
|
|
17
|
+
// | "brand" (the homepage AI cards: brand fill, a badge, an h3 and an art column)
|
|
18
|
+
tone : { type: String, reflect: true },
|
|
19
|
+
// the small label over the title; drawn only on tone="brand"
|
|
20
|
+
badge : { type: String },
|
|
21
|
+
// the title's level in the outline; tone="brand" draws it at the h3 role
|
|
22
|
+
as : { type: String }
|
|
16
23
|
};
|
|
17
24
|
|
|
18
25
|
static styles = [tokens, bentoItemCSS];
|
|
@@ -25,9 +32,66 @@ class BentoItem extends LitElement {
|
|
|
25
32
|
this.priority = "standard";
|
|
26
33
|
this.orientation = "auto";
|
|
27
34
|
this.tone = "default";
|
|
35
|
+
this.badge = "";
|
|
36
|
+
this.as = "h3";
|
|
37
|
+
this._ctas = [];
|
|
38
|
+
this._ownWidth = new WeakMap();
|
|
39
|
+
this._phone = window.matchMedia?.(below("md"));
|
|
40
|
+
this._onPhone = () => this._syncCtas();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
connectedCallback() {
|
|
44
|
+
super.connectedCallback();
|
|
45
|
+
this._phone?.addEventListener("change", this._onPhone);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
disconnectedCallback() {
|
|
49
|
+
super.disconnectedCallback();
|
|
50
|
+
this._phone?.removeEventListener("change", this._onPhone);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_onCtaSlot(e) {
|
|
54
|
+
this._ctas = e.target.assignedElements({ flatten: true });
|
|
55
|
+
this._syncCtas();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* On a phone the CTA runs the card's width, as the Figma phone frame draws
|
|
59
|
+
it; from md it hugs its label. A bd-button-link stretches only through
|
|
60
|
+
its own fullwidth attribute, so the card sets it below md and gives an
|
|
61
|
+
author's own setting back from md. */
|
|
62
|
+
_syncCtas() {
|
|
63
|
+
const phone = !!this._phone?.matches;
|
|
64
|
+
for (const el of this._ctas) {
|
|
65
|
+
if (!("fullWidth" in el)) continue;
|
|
66
|
+
if (!this._ownWidth.has(el)) this._ownWidth.set(el, el.hasAttribute("fullwidth"));
|
|
67
|
+
el.toggleAttribute("fullwidth", phone || this._ownWidth.get(el));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* The homepage AI card, drawn in the foundation Figma file as Bento card:
|
|
72
|
+
the copy -- an info badge, the title at h3 and the body in the brand's
|
|
73
|
+
ink --, the art from the `media` slot, and the CTA, the default slot (an
|
|
74
|
+
outline-white bd-button-link, lg). In that order on a phone, a column;
|
|
75
|
+
from md the copy and the CTA stack on the near side and the art fills the
|
|
76
|
+
rest of the card. */
|
|
77
|
+
_renderBrand() {
|
|
78
|
+
return html`
|
|
79
|
+
<div class="bd-bentoitem-box bd-bentoitem-brand">
|
|
80
|
+
<div class="bd-bentoitem-text">
|
|
81
|
+
${this.badge ? html`<bd-badge tone="info" variant="shade" size="sm">${this.badge}</bd-badge>` : ""}
|
|
82
|
+
${this.title
|
|
83
|
+
? html`<bd-h as="${this.as}" visual-level="h3" color="on-brand" class="bd-bentoitem-brand-title">${this.title}</bd-h>`
|
|
84
|
+
: ""}
|
|
85
|
+
${this.body ? html`<p class="bd-bentoitem-brand-body">${this.body}</p>` : ""}
|
|
86
|
+
</div>
|
|
87
|
+
<div class="bd-bentoitem-media"><slot name="media"></slot></div>
|
|
88
|
+
<div class="bd-bentoitem-cta"><slot @slotchange=${this._onCtaSlot}></slot></div>
|
|
89
|
+
</div>
|
|
90
|
+
`;
|
|
28
91
|
}
|
|
29
92
|
|
|
30
93
|
render() {
|
|
94
|
+
if (this.tone === "brand") return this._renderBrand();
|
|
31
95
|
return html`
|
|
32
96
|
<div class="bd-bentoitem-box">
|
|
33
97
|
<div class="bd-bentoitem-icon-wrap">
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { css, unsafeCSS } from "lit";
|
|
2
|
+
import { above } from "../shared/token-scales.js";
|
|
3
|
+
|
|
4
|
+
/* Mobile first, in the three frames the Figma Hero draws.
|
|
5
|
+
below md the video on top, the copy centred under it and rising 112 into
|
|
6
|
+
its fade; the cards follow the band on the page
|
|
7
|
+
md to lg the same, the copy rising 64
|
|
8
|
+
lg and up the video fills the band, the copy sits left over it, and the
|
|
9
|
+
cards rise 128 into the band's lower edge
|
|
10
|
+
All ink on the band is the brand's own (--color-brand-on-fill), so a light
|
|
11
|
+
partner brand takes dark copy. */
|
|
12
|
+
export const heroCSS = css`
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.band {
|
|
18
|
+
position: relative;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
background: var(--color-surface-brand);
|
|
21
|
+
padding-block-end: var(--spacing-40);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.stage {
|
|
25
|
+
position: relative;
|
|
26
|
+
/* no token: the video's box on a phone and a tablet, 360 tall in both
|
|
27
|
+
frames; the dimension scale stops at 64 */
|
|
28
|
+
height: 360px;
|
|
29
|
+
/* the slotted art sizes itself from the stage's height */
|
|
30
|
+
container-type: size;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Below lg the box is narrower than the art, so the crop follows its
|
|
34
|
+
subject: --bd-hero-media-position lets a page say where that is in its
|
|
35
|
+
own video. The default holds the homepage sphere, right of centre. */
|
|
36
|
+
.media {
|
|
37
|
+
display: block;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
object-fit: cover;
|
|
41
|
+
object-position: var(--bd-hero-media-position, 74% 50%);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Slotted art (bd-motion-art) is square and sizes itself from its own
|
|
45
|
+
width, so the stage gives it one, centred on the stage. The sphere fills
|
|
46
|
+
78% of the art, and the phone and tablet frames draw it about 320 and
|
|
47
|
+
340 across in the 360 stage: 112% of the stage's height on a phone, 120%
|
|
48
|
+
from md, the glow running off the stage's edges. Margins, not a
|
|
49
|
+
translate, so it centres in RTL too. */
|
|
50
|
+
::slotted([slot="media"]) {
|
|
51
|
+
position: absolute;
|
|
52
|
+
inset-block-start: 50%;
|
|
53
|
+
inset-inline-start: 50%;
|
|
54
|
+
width: 112cqh;
|
|
55
|
+
margin-block-start: -56cqh;
|
|
56
|
+
margin-inline-start: -56cqh;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* The video fades into the band so the copy has a solid ground under it:
|
|
60
|
+
the brand at 0, 60, 95 and 100%. No token: four stops of a gradient,
|
|
61
|
+
mixed from the brand surface so a partner brand fades into its own. */
|
|
62
|
+
.fade {
|
|
63
|
+
position: absolute;
|
|
64
|
+
inset-inline: 0;
|
|
65
|
+
inset-block-end: 0;
|
|
66
|
+
height: 64%;
|
|
67
|
+
background: linear-gradient(
|
|
68
|
+
to bottom,
|
|
69
|
+
color-mix(in srgb, var(--color-surface-brand) 0%, transparent) 0%,
|
|
70
|
+
color-mix(in srgb, var(--color-surface-brand) 60%, transparent) 45%,
|
|
71
|
+
color-mix(in srgb, var(--color-surface-brand) 95%, transparent) 80%,
|
|
72
|
+
var(--color-surface-brand) 100%
|
|
73
|
+
);
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.column {
|
|
78
|
+
position: relative;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.copy {
|
|
82
|
+
position: relative;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
align-items: center;
|
|
86
|
+
gap: var(--spacing-8);
|
|
87
|
+
margin-block-start: calc(-1 * var(--spacing-112));
|
|
88
|
+
text-align: center;
|
|
89
|
+
color: var(--color-brand-on-fill);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.eyebrow,
|
|
93
|
+
.heading,
|
|
94
|
+
.lead {
|
|
95
|
+
margin: 0;
|
|
96
|
+
color: inherit;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* The eyebrow is a heading role without being a heading: only "Cybersecurity
|
|
100
|
+
for the AI Era." is the h1. h4 on a phone, h3 from md. */
|
|
101
|
+
.eyebrow {
|
|
102
|
+
font-family: var(--typography-heading-h4-fontFamily);
|
|
103
|
+
font-size: var(--typography-heading-h4-fontSize);
|
|
104
|
+
font-weight: var(--typography-heading-h4-fontWeight);
|
|
105
|
+
line-height: var(--typography-heading-h4-lineHeight);
|
|
106
|
+
letter-spacing: var(--typography-heading-h4-letterSpacing);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.heading {
|
|
110
|
+
font-family: var(--typography-display-sm-fontFamily);
|
|
111
|
+
font-size: var(--typography-display-sm-fontSize);
|
|
112
|
+
font-weight: var(--typography-display-sm-fontWeight);
|
|
113
|
+
line-height: var(--typography-display-sm-lineHeight);
|
|
114
|
+
letter-spacing: var(--typography-display-sm-letterSpacing);
|
|
115
|
+
overflow-wrap: break-word;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.lead {
|
|
119
|
+
font-family: var(--typography-body-regular-fontFamily);
|
|
120
|
+
font-size: var(--typography-body-regular-fontSize);
|
|
121
|
+
font-weight: var(--typography-body-regular-fontWeight);
|
|
122
|
+
line-height: var(--typography-body-regular-lineHeight);
|
|
123
|
+
letter-spacing: var(--typography-body-regular-letterSpacing);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* the pause button sits in the video's top corner at every width */
|
|
127
|
+
.toggle {
|
|
128
|
+
position: absolute;
|
|
129
|
+
z-index: var(--z-raised);
|
|
130
|
+
inset-block-start: var(--spacing-16);
|
|
131
|
+
inset-inline-end: var(--spacing-16);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Below lg the cards follow the band on its own ground, full-bleed, so
|
|
135
|
+
the section is one brand block: the phone frame closes it 24 under the
|
|
136
|
+
cards, the tablet frame 32. The column inside keeps the cards on the
|
|
137
|
+
page's edges. */
|
|
138
|
+
.cards-band {
|
|
139
|
+
position: relative;
|
|
140
|
+
z-index: var(--z-base);
|
|
141
|
+
background: var(--color-surface-brand);
|
|
142
|
+
padding-block-end: var(--spacing-24);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.cards-band[hidden] {
|
|
146
|
+
display: none;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media ${unsafeCSS(above("md"))} {
|
|
150
|
+
.copy {
|
|
151
|
+
margin-block-start: calc(-1 * var(--spacing-64));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.cards-band {
|
|
155
|
+
padding-block-end: var(--spacing-32);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
::slotted([slot="media"]) {
|
|
159
|
+
width: 120cqh;
|
|
160
|
+
margin-block-start: -60cqh;
|
|
161
|
+
margin-inline-start: -60cqh;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.eyebrow {
|
|
165
|
+
font-family: var(--typography-heading-h3-fontFamily);
|
|
166
|
+
font-size: var(--typography-heading-h3-fontSize);
|
|
167
|
+
font-weight: var(--typography-heading-h3-fontWeight);
|
|
168
|
+
line-height: var(--typography-heading-h3-lineHeight);
|
|
169
|
+
letter-spacing: var(--typography-heading-h3-letterSpacing);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.heading {
|
|
173
|
+
font-family: var(--typography-display-md-fontFamily);
|
|
174
|
+
font-size: var(--typography-display-md-fontSize);
|
|
175
|
+
font-weight: var(--typography-display-md-fontWeight);
|
|
176
|
+
line-height: var(--typography-display-md-lineHeight);
|
|
177
|
+
letter-spacing: var(--typography-display-md-letterSpacing);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.lead {
|
|
181
|
+
font-size: var(--typography-body-large-fontSize);
|
|
182
|
+
font-weight: var(--typography-body-large-fontWeight);
|
|
183
|
+
line-height: var(--typography-body-large-lineHeight);
|
|
184
|
+
letter-spacing: var(--typography-body-large-letterSpacing);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@media ${unsafeCSS(above("lg"))} {
|
|
189
|
+
.band {
|
|
190
|
+
padding-block: var(--spacing-64) var(--spacing-40);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* the video fills the whole band behind the copy */
|
|
194
|
+
.stage {
|
|
195
|
+
position: absolute;
|
|
196
|
+
inset: 0;
|
|
197
|
+
height: auto;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.media {
|
|
201
|
+
object-position: var(--bd-hero-media-position-lg, 50% 50%);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* the art sits right of the copy, where the poster draws the sphere,
|
|
205
|
+
as tall as the band */
|
|
206
|
+
::slotted([slot="media"]) {
|
|
207
|
+
inset-inline-start: var(--bd-hero-art-position-lg, 74%);
|
|
208
|
+
width: 100cqh;
|
|
209
|
+
margin-block-start: -50cqh;
|
|
210
|
+
margin-inline-start: -50cqh;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.fade {
|
|
214
|
+
height: 40%;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.copy {
|
|
218
|
+
align-items: flex-start;
|
|
219
|
+
margin-block-start: 0;
|
|
220
|
+
text-align: start;
|
|
221
|
+
/* not the column: the copy's measure, the left half of the page that
|
|
222
|
+
the design keeps clear of the sphere on the right.
|
|
223
|
+
no token: 588 is a measure, and the dimension scale stops at 64 */
|
|
224
|
+
max-width: 588px;
|
|
225
|
+
gap: var(--spacing-16);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.heading {
|
|
229
|
+
font-family: var(--typography-display-xl-fontFamily);
|
|
230
|
+
font-size: var(--typography-display-xl-fontSize);
|
|
231
|
+
font-weight: var(--typography-display-xl-fontWeight);
|
|
232
|
+
line-height: var(--typography-display-xl-lineHeight);
|
|
233
|
+
letter-spacing: var(--typography-display-xl-letterSpacing);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.toggle {
|
|
237
|
+
inset-block-start: var(--spacing-24);
|
|
238
|
+
inset-inline-end: var(--spacing-24);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* the cards rise into the band's lower edge */
|
|
242
|
+
.has-cards .band {
|
|
243
|
+
padding-block-end: calc(var(--spacing-40) + var(--spacing-128));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* from lg the cards rise into the band over the page, as the desktop
|
|
247
|
+
frame draws them */
|
|
248
|
+
.cards-band {
|
|
249
|
+
margin-block-start: calc(-1 * var(--spacing-128));
|
|
250
|
+
padding-block-end: 0;
|
|
251
|
+
background: none;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@media (prefers-reduced-motion: reduce) {
|
|
256
|
+
.toggle {
|
|
257
|
+
display: none;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
`;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { LitElement, html, nothing } from "lit";
|
|
2
|
+
import { tokens } from "../../tokens/tokens.js";
|
|
3
|
+
import "../button/button.js";
|
|
4
|
+
import "../icons/pause-icon.js";
|
|
5
|
+
import "../icons/play-icon.js";
|
|
6
|
+
import { ensembleCSS } from "../shared/ensemble.css.js";
|
|
7
|
+
import { heroCSS } from "./hero.css.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The homepage hero: a brand band with a full-bleed looping video fading into
|
|
11
|
+
* the brand at the bottom, an eyebrow, the page's one h1 and a lead. Drawn in
|
|
12
|
+
* the foundation Figma file as Hero.
|
|
13
|
+
*
|
|
14
|
+
* Desktop sets the copy left over the video; below lg the video sits on top
|
|
15
|
+
* and the copy is centred under it. Slot `cards` takes the audience cards:
|
|
16
|
+
* from lg they overlap the band's lower edge, below it they follow the band
|
|
17
|
+
* on the same brand ground, as the phone and tablet frames draw them.
|
|
18
|
+
*
|
|
19
|
+
* Not bd-header. That is the white two-column product hero with a price; this
|
|
20
|
+
* one sells nothing and carries no CTA.
|
|
21
|
+
*
|
|
22
|
+
* Slot `media` takes animated art in the video's place: the homepage slots
|
|
23
|
+
* <bd-motion-art object="brand-surface">. Slotted, it replaces the video and
|
|
24
|
+
* the poster, and it is centred in the stage below lg and on the sphere's
|
|
25
|
+
* line, right of the copy, from lg.
|
|
26
|
+
*
|
|
27
|
+
* The video loops on its own, so there is a pause button (WCAG 2.2.2). Under
|
|
28
|
+
* prefers-reduced-motion it never plays: the poster stands still in its place.
|
|
29
|
+
* Without a video-src the poster is all there is, and so is no button. The
|
|
30
|
+
* slotted art takes no button: it holds a still frame of its own under
|
|
31
|
+
* prefers-reduced-motion, and stops with `paused` when a page sets it.
|
|
32
|
+
*/
|
|
33
|
+
export class Hero extends LitElement {
|
|
34
|
+
static properties = {
|
|
35
|
+
eyebrow : { type: String },
|
|
36
|
+
heading : { type: String },
|
|
37
|
+
lead : { type: String },
|
|
38
|
+
videoSrc : { type: String, attribute: "video-src" },
|
|
39
|
+
poster : { type: String },
|
|
40
|
+
paused : { type: Boolean, reflect: true },
|
|
41
|
+
pauseLabel: { type: String, attribute: "pause-label" },
|
|
42
|
+
playLabel : { type: String, attribute: "play-label" },
|
|
43
|
+
_reduced : { state: true },
|
|
44
|
+
_hasCards : { state: true },
|
|
45
|
+
_hasMedia : { state: true }
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
static styles = [tokens, ensembleCSS, heroCSS];
|
|
49
|
+
|
|
50
|
+
constructor() {
|
|
51
|
+
super();
|
|
52
|
+
this.eyebrow = "";
|
|
53
|
+
this.heading = "";
|
|
54
|
+
this.lead = "";
|
|
55
|
+
this.videoSrc = "";
|
|
56
|
+
this.poster = "";
|
|
57
|
+
this.paused = false;
|
|
58
|
+
this.pauseLabel = "Pause the background video";
|
|
59
|
+
this.playLabel = "Play the background video";
|
|
60
|
+
this._motion = window.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
61
|
+
this._reduced = !!this._motion?.matches;
|
|
62
|
+
this._hasCards = false;
|
|
63
|
+
this._hasMedia = false;
|
|
64
|
+
this._onMotion = () => { this._reduced = this._motion.matches; };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
super.connectedCallback();
|
|
69
|
+
this._motion?.addEventListener("change", this._onMotion);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
disconnectedCallback() {
|
|
73
|
+
super.disconnectedCallback();
|
|
74
|
+
this._motion?.removeEventListener("change", this._onMotion);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
updated(changed) {
|
|
78
|
+
if (changed.has("paused") || changed.has("_hasMedia")) this._syncMedia();
|
|
79
|
+
if (!changed.has("paused") && !changed.has("_reduced") && !changed.has("videoSrc")) return;
|
|
80
|
+
const video = this.renderRoot.querySelector("video");
|
|
81
|
+
if (!video) return;
|
|
82
|
+
if (this.paused || this._reduced) video.pause();
|
|
83
|
+
else video.play()?.catch(() => { /* autoplay refused: the poster stays */ });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_toggle() {
|
|
87
|
+
this.paused = !this.paused;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
_onCardsSlot(e) {
|
|
91
|
+
this._hasCards = e.target.assignedElements({ flatten: true }).length > 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_onMediaSlot(e) {
|
|
95
|
+
this._media = e.target.assignedElements({ flatten: true });
|
|
96
|
+
this._hasMedia = this._media.length > 0;
|
|
97
|
+
this._syncMedia();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* the slotted art stops with the hero's `paused` */
|
|
101
|
+
_syncMedia() {
|
|
102
|
+
for (const el of this._media ?? []) if ("paused" in el) el.paused = this.paused;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_renderMedia() {
|
|
106
|
+
if (this._hasMedia) return nothing;
|
|
107
|
+
if (this.videoSrc) {
|
|
108
|
+
return html`<video
|
|
109
|
+
class="media"
|
|
110
|
+
src="${this.videoSrc}"
|
|
111
|
+
poster="${this.poster || nothing}"
|
|
112
|
+
?autoplay=${!this._reduced && !this.paused}
|
|
113
|
+
muted
|
|
114
|
+
loop
|
|
115
|
+
playsinline
|
|
116
|
+
preload="metadata"
|
|
117
|
+
aria-hidden="true"
|
|
118
|
+
tabindex="-1"
|
|
119
|
+
.muted=${true}
|
|
120
|
+
></video>`;
|
|
121
|
+
}
|
|
122
|
+
return this.poster
|
|
123
|
+
? html`<img class="media" src="${this.poster}" alt="" aria-hidden="true">`
|
|
124
|
+
: nothing;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
render() {
|
|
128
|
+
const moving = this.videoSrc && !this._hasMedia && !this._reduced;
|
|
129
|
+
return html`
|
|
130
|
+
<section class="root ${this._hasCards ? "has-cards" : ""}">
|
|
131
|
+
<div class="band">
|
|
132
|
+
<div class="stage">
|
|
133
|
+
${this._renderMedia()}
|
|
134
|
+
<slot name="media" @slotchange=${this._onMediaSlot}></slot>
|
|
135
|
+
<div class="fade"></div>
|
|
136
|
+
${moving
|
|
137
|
+
? html`<bd-button
|
|
138
|
+
class="toggle"
|
|
139
|
+
variant="outline-white"
|
|
140
|
+
surface="brand"
|
|
141
|
+
size="md"
|
|
142
|
+
icon-only
|
|
143
|
+
label="${this.paused ? this.playLabel : this.pauseLabel}"
|
|
144
|
+
@click=${this._toggle}
|
|
145
|
+
>${this.paused
|
|
146
|
+
? html`<bd-play-icon size="md"></bd-play-icon>`
|
|
147
|
+
: html`<bd-pause-icon size="md"></bd-pause-icon>`}</bd-button>`
|
|
148
|
+
: nothing}
|
|
149
|
+
</div>
|
|
150
|
+
<div class="bd-ensemble column">
|
|
151
|
+
<div class="copy">
|
|
152
|
+
${this.eyebrow ? html`<p class="eyebrow">${this.eyebrow}</p>` : nothing}
|
|
153
|
+
<h1 class="heading">${this.heading}</h1>
|
|
154
|
+
${this.lead ? html`<p class="lead">${this.lead}</p>` : nothing}
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="cards-band" ?hidden=${!this._hasCards}>
|
|
159
|
+
<div class="bd-ensemble cards">
|
|
160
|
+
<slot name="cards" @slotchange=${this._onCardsSlot}></slot>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</section>
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
customElements.define("bd-hero", Hero);
|