Skip to content

Commit 4bb8a1f

Browse files
committed
Refine Steam navigation and trailer spacing
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3bca27e8-1e03-415b-801a-f6bf81a6ba9e
1 parent 56a033e commit 4bb8a1f

5 files changed

Lines changed: 88 additions & 100 deletions

File tree

website/src/components/home/TrailerHero.test.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,10 @@ import { describe, expect, it } from 'vitest';
33
import TrailerHero from './TrailerHero.vue';
44

55
describe('TrailerHero', () => {
6-
it('links to Steam without the retired Watch film copy', () => {
6+
it('does not render promotional copy or a Steam link over the trailer', () => {
77
const wrapper = mount(TrailerHero);
8-
const steamLink = wrapper.get('a');
98

10-
expect(steamLink.text()).toBe('Get Straif on Steam');
11-
expect(steamLink.attributes()).toMatchObject({
12-
href: 'https://store.steampowered.com/app/3850480/Straif/',
13-
target: '_blank',
14-
rel: 'noopener noreferrer',
15-
});
9+
expect(wrapper.find('a').exists()).toBe(false);
1610
expect(wrapper.text()).not.toMatch(/watch film/i);
1711
});
1812

website/src/components/home/TrailerHero.vue

Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,53 @@ const trailerSrc =
77
</script>
88

99
<template>
10-
<section class="trailer-hero" aria-labelledby="trailer-title">
11-
<div class="trailer-hero__copy">
12-
<p>Official trailer · YouTube</p>
13-
<h1 id="trailer-title">Straif</h1>
14-
<a
15-
class="trailer-hero__steam"
16-
href="https://store.steampowered.com/app/3850480/Straif/"
17-
target="_blank"
18-
rel="noopener noreferrer"
19-
>
20-
Get Straif on Steam
21-
</a>
22-
</div>
10+
<div class="trailer-hero-shell">
11+
<section class="trailer-hero" aria-labelledby="trailer-title">
12+
<div class="trailer-hero__copy">
13+
<p>Official trailer · YouTube</p>
14+
<h1 id="trailer-title">Straif</h1>
15+
</div>
2316

24-
<div class="trailer-hero__media">
25-
<template v-if="isPlaying">
26-
<iframe
27-
:src="trailerSrc"
28-
title="Straif official trailer"
29-
allow="
30-
accelerometer;
31-
autoplay;
32-
clipboard-write;
33-
encrypted-media;
34-
gyroscope;
35-
picture-in-picture;
36-
web-share;
37-
"
38-
allowfullscreen
39-
/>
40-
</template>
41-
<template v-else>
42-
<img
43-
src="https://i.ytimg.com/vi/CfzotZZ3Sd0/maxresdefault.jpg"
44-
alt=""
45-
width="1280"
46-
height="720"
47-
fetchpriority="high"
48-
/>
49-
<button
50-
type="button"
51-
aria-label="Play the Straif trailer"
52-
@click="isPlaying = true"
53-
>
54-
<svg
55-
aria-hidden="true"
56-
viewBox="0 0 24 24"
57-
focusable="false"
17+
<div class="trailer-hero__media">
18+
<template v-if="isPlaying">
19+
<iframe
20+
:src="trailerSrc"
21+
title="Straif official trailer"
22+
allow="
23+
accelerometer;
24+
autoplay;
25+
clipboard-write;
26+
encrypted-media;
27+
gyroscope;
28+
picture-in-picture;
29+
web-share;
30+
"
31+
allowfullscreen
32+
/>
33+
</template>
34+
<template v-else>
35+
<img
36+
src="https://i.ytimg.com/vi/CfzotZZ3Sd0/maxresdefault.jpg"
37+
alt=""
38+
width="1280"
39+
height="720"
40+
fetchpriority="high"
41+
/>
42+
<button
43+
type="button"
44+
aria-label="Play the Straif trailer"
45+
@click="isPlaying = true"
5846
>
59-
<path d="M8.5 5.75 19 12 8.5 18.25Z" />
60-
</svg>
61-
</button>
62-
</template>
63-
</div>
64-
</section>
47+
<svg
48+
aria-hidden="true"
49+
viewBox="0 0 24 24"
50+
focusable="false"
51+
>
52+
<path d="M8.5 5.75 19 12 8.5 18.25Z" />
53+
</svg>
54+
</button>
55+
</template>
56+
</div>
57+
</section>
58+
</div>
6559
</template>

website/src/components/layout/SiteChrome.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('site Steam links', () => {
2929
target: '_blank',
3030
rel: 'noopener noreferrer',
3131
});
32+
expect(link.get('svg').attributes('aria-hidden')).toBe('true');
3233
});
3334

3435
it('adds the approved Steam link to the footer', () => {

website/src/components/layout/SiteHeader.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
target="_blank"
1313
rel="noopener noreferrer"
1414
>
15+
<svg aria-hidden="true" viewBox="0 0 24 24" focusable="false">
16+
<circle cx="15.5" cy="8.5" r="4.25" />
17+
<circle cx="5.75" cy="17.25" r="2.75" />
18+
<path d="m8.1 15.8 4.4-4.4" />
19+
</svg>
1520
Get Straif
1621
</a>
1722
</nav>

website/src/styles/base.css

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,23 @@ a {
172172
}
173173

174174
.site-header nav .site-header__cta {
175+
display: inline-flex;
176+
align-items: center;
177+
gap: 0.45rem;
175178
border: 1px solid var(--color-border-strong);
176179
color: var(--color-text);
177180
padding: 0.45rem 0.65rem;
181+
white-space: nowrap;
182+
}
183+
184+
.site-header__cta svg {
185+
width: 1rem;
186+
height: 1rem;
187+
fill: none;
188+
stroke: currentColor;
189+
stroke-linecap: round;
190+
stroke-linejoin: round;
191+
stroke-width: 1.75;
178192
}
179193

180194
.site-header nav a.router-link-exact-active {
@@ -191,16 +205,21 @@ a {
191205
text-transform: uppercase;
192206
}
193207

194-
.trailer-hero {
195-
position: relative;
196-
isolation: isolate;
208+
.trailer-hero-shell {
197209
width: min(
198210
calc(100% - var(--page-gutter) - var(--page-gutter)),
199211
84rem,
200212
calc(156.4444vh - 7.1111rem)
201213
);
202-
max-height: calc(88vh - 4rem);
214+
margin-top: clamp(0.75rem, 2vw, 1.5rem);
203215
margin-inline: auto;
216+
}
217+
218+
.trailer-hero {
219+
position: relative;
220+
isolation: isolate;
221+
width: 100%;
222+
max-height: calc(88vh - 4rem);
204223
overflow: hidden;
205224
aspect-ratio: 16 / 9;
206225
background: var(--color-surface);
@@ -270,15 +289,14 @@ a {
270289
right: var(--page-gutter);
271290
bottom: var(--page-gutter);
272291
left: var(--page-gutter);
273-
display: flex;
292+
display: grid;
293+
grid-template-columns: 1fr auto 1fr;
274294
align-items: flex-end;
275-
justify-content: space-between;
276295
gap: 1.5rem;
277296
pointer-events: none;
278297
}
279298

280-
.trailer-hero__copy > p,
281-
.trailer-hero__steam {
299+
.trailer-hero__copy > p {
282300
width: 10rem;
283301
color: var(--color-text);
284302
font-family: var(--font-data);
@@ -290,24 +308,6 @@ a {
290308
text-transform: uppercase;
291309
}
292310

293-
.trailer-hero__steam {
294-
box-sizing: border-box;
295-
border: 1px solid oklch(0.96 0.007 100 / 0.72);
296-
background: oklch(0.115 0 0 / 0.82);
297-
padding: 0.7rem 0.8rem;
298-
pointer-events: auto;
299-
text-align: center;
300-
text-decoration: none;
301-
transition:
302-
background-color var(--transition-fast),
303-
border-color var(--transition-fast),
304-
transform var(--transition-fast);
305-
}
306-
307-
.trailer-hero__steam:active {
308-
transform: scale(0.98);
309-
}
310-
311311
.trailer-hero h1,
312312
.page-heading h1 {
313313
font-size: clamp(3rem, 8vw, 7.5rem);
@@ -715,11 +715,6 @@ a {
715715
transform: translate(-50%, -50%) scale(1.04);
716716
}
717717

718-
.trailer-hero__steam:hover {
719-
border-color: var(--color-text);
720-
background: oklch(0.115 0 0 / 0.94);
721-
}
722-
723718
.leaderboard-tabs button:hover {
724719
color: var(--color-text);
725720
}
@@ -749,13 +744,17 @@ a {
749744
}
750745

751746
.site-header {
752-
gap: 1rem;
747+
gap: 0.75rem;
753748
padding-block: 1.25rem;
754749
}
755750

756751
.site-header nav {
757752
justify-content: flex-end;
758-
gap: 1rem;
753+
gap: 0.625rem;
754+
}
755+
756+
.site-header nav .site-header__cta {
757+
padding-inline: 0.45rem;
759758
}
760759

761760
.site-footer {
@@ -774,16 +773,11 @@ a {
774773
gap: 1rem;
775774
}
776775

777-
.trailer-hero__copy > p,
778-
.trailer-hero__steam {
776+
.trailer-hero__copy > p {
779777
width: min(9rem, 42vw);
780778
font-size: 0.625rem;
781779
}
782780

783-
.trailer-hero__steam {
784-
display: block;
785-
}
786-
787781
.game-intro {
788782
grid-template-columns: minmax(0, 1fr);
789783
gap: 2rem;

0 commit comments

Comments
 (0)