Skip to content

Commit ad95bb6

Browse files
committed
Add focus-visible handling and improve styling on Download pages
1 parent 957a4ab commit ad95bb6

3 files changed

Lines changed: 101 additions & 77 deletions

File tree

src/components/Pages/Downloads/index.astro

Lines changed: 97 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const {
2424
fileType,
2525
fileSize,
2626
pages,
27-
title,
2827
} = download.data
2928
3029
const { Content } = await render(download)
@@ -33,72 +32,90 @@ const normalizedDownloadUrl = `/downloads/${fileName}`
3332
---
3433

3534
<download-form class="mb-8 md:mb-30">
35+
<section class="mb-8 md:mb-12" aria-label="Download header">
36+
<div class="rounded-2xl border border-trim-offset bg-page-base p-6 md:p-8 shadow-sm">
37+
<p class="text-sm font-semibold uppercase tracking-[0.22em] text-page-inverse">
38+
Free Download
39+
</p>
40+
<p class="leading-relaxed text-content-offset md:text-base">
41+
Get the ebook instantly. Review the outline, enter your work email, and open the download in one step.
42+
</p>
43+
</div>
44+
</section>
45+
3646
{/* Two-column layout on desktop: info left, form right */}
37-
<div class="grid grid-cols-1 lg:grid-cols-3 gap-2 md:gap-10 lg:gap-12 items-start">
47+
<div class="grid grid-cols-1 gap-6 md:gap-10 lg:grid-cols-3 lg:gap-12 items-start">
3848
{/* Left column: cover, meta, content */}
3949
<div class="lg:col-span-2">
40-
<div class="flex flex-col md:flex-row items-start gap-6mb-8">
41-
{
42-
cover && (
43-
<section
44-
class="relative aspect-square w-60 md:w-80 max-w-full mx-auto md:mx-0 rounded-2xl overflow-hidden shrink-0"
45-
aria-label="Cover image"
46-
>
47-
<Picture
48-
src={cover}
49-
alt={coverAlt}
50-
widths={[320, 480, 640]}
51-
sizes="(min-width: 768px) 320px, 100vw"
52-
formats={['avif', 'webp', 'jpeg']}
53-
layout="constrained"
54-
fit="cover"
55-
position="center"
56-
class="absolute inset-0 h-full w-full object-cover"
57-
loading="eager"
58-
/>
59-
</section>
60-
)
61-
}
62-
63-
{/* Resource Meta Information */}
64-
<section
65-
class="w-full px-6 md:px-0 md:mx-6 mt-6 md:mt-1"
66-
aria-label="Resource details"
67-
>
68-
<p class="text-lg text-page-inverse leading-relaxed mt-1 mb-6 p-6 bg-page-offset rounded-xl border border-trim">
69-
{download.data.description}
70-
</p>
50+
<div class="overflow-hidden rounded-2xl border border-trim-offset bg-page-base shadow-sm">
51+
<div class="flex flex-col items-stretch gap-0 md:flex-row">
52+
{
53+
cover && (
54+
<div class="w-full md:w-1/3 bg-page-offset p-6 md:p-10 flex justify-center items-center">
55+
<section
56+
class="relative aspect-square w-56 md:w-full max-w-70 rounded-xl overflow-hidden border-2 border-trim shadow-md"
57+
aria-label="Cover image"
58+
>
59+
<Picture
60+
src={cover}
61+
alt={coverAlt}
62+
widths={[320, 480, 640]}
63+
sizes="(min-width: 1024px) 280px, (min-width: 768px) 240px, 100vw"
64+
formats={['avif', 'webp', 'jpeg']}
65+
layout="constrained"
66+
fit="cover"
67+
position="center"
68+
class="absolute inset-0 h-full w-full object-cover"
69+
loading="eager"
70+
/>
71+
</section>
72+
</div>
73+
)
74+
}
7175

72-
<dl class="flex items-center justify-center gap-6">
73-
<div class="flex items-center gap-2">
74-
<Icon icon="document" size={6} color="page-inverse" />
75-
<dt class="sr-only">File type</dt>
76-
<dd class="text-sm font-medium text-page-inverse">{fileType}</dd>
77-
</div>
78-
{
79-
pages && (
80-
<div class="flex items-center gap-2">
81-
<Icon icon="book" size={6} color="page-inverse" />
82-
<dt class="sr-only">Pages</dt>
83-
<dd class="text-sm text-page-inverse">{pages} pages</dd>
84-
</div>
85-
)
86-
}
87-
{
88-
fileSize && (
89-
<div class="flex items-center gap-2">
90-
<Icon icon="file" size={6} color="page-inverse" />
91-
<dt class="sr-only">File size</dt>
92-
<dd class="text-sm text-page-inverse">{fileSize}</dd>
93-
</div>
94-
)
95-
}
96-
</dl>
97-
</section>
76+
{/* Resource Meta Information */}
77+
<section
78+
class:list={[
79+
'w-full bg-page-base p-6 md:p-10 flex flex-col justify-center',
80+
cover ? 'md:w-2/3' : '',
81+
]}
82+
aria-label="Resource details"
83+
>
84+
<p class="text-lg md:text-xl text-content leading-relaxed mb-6">
85+
{download.data.description}
86+
</p>
87+
88+
<dl class="flex items-center gap-4 md:gap-6 flex-wrap text-content-offset">
89+
<div class="flex items-center gap-2 border-r border-trim pr-4 md:pr-6">
90+
<Icon icon="document" size={5} color="content-offset" />
91+
<dt class="sr-only">File type</dt>
92+
<dd class="text-sm font-semibold">{fileType} Download</dd>
93+
</div>
94+
{
95+
pages && (
96+
<div class="flex items-center gap-2 border-r border-trim pr-4 md:pr-6">
97+
<Icon icon="book" size={5} color="content-offset" />
98+
<dt class="sr-only">Pages</dt>
99+
<dd class="text-sm font-semibold">{pages} pages</dd>
100+
</div>
101+
)
102+
}
103+
{
104+
fileSize && (
105+
<div class="flex items-center gap-2">
106+
<Icon icon="file" size={5} color="content-offset" />
107+
<dt class="sr-only">File size</dt>
108+
<dd class="text-sm font-semibold">{fileSize}</dd>
109+
</div>
110+
)
111+
}
112+
</dl>
113+
</section>
114+
</div>
98115
</div>
99116

100117
<section
101-
class="md:mt-4 md:mb-8 pt-4 md:p-4"
118+
class="mt-6 md:mt-8 md:mb-8 rounded-2xl border border-trim-offset bg-page-base p-6 md:p-8"
102119
aria-label="Resource details"
103120
>
104121
<Content components={{ ...Components }} />
@@ -107,10 +124,13 @@ const normalizedDownloadUrl = `/downloads/${fileName}`
107124

108125
{/* Right column: download form */}
109126
<div class="lg:col-span-1 lg:sticky lg:top-24">
110-
<div class="bg-(--color-blue-600) p-6 md:p-8 rounded-2xl border border-(--color-blue-800)">
127+
<div class="rounded-2xl bg-page-inverse p-6 md:p-8 shadow-lg">
111128
<div class="mb-6">
112-
<h3 class="text-xl md:text-2xl font-semibold mb-2 text-white">{title}</h3>
113-
<p class="text-(--color-blue-100)">
129+
<p class="mb-2 text-xs font-semibold uppercase tracking-[0.22em] text-content-inverse-active">
130+
Instant Access
131+
</p>
132+
<h3 class="text-xl md:text-2xl font-semibold mb-2 text-primary-inverse">Get The Ebook</h3>
133+
<p class="text-content-inverse-active">
114134
Fill out the form below to receive your {fileType.toLowerCase()} instantly.
115135
</p>
116136
</div>
@@ -124,15 +144,15 @@ const normalizedDownloadUrl = `/downloads/${fileName}`
124144
<div class="space-y-4">
125145
{/* First Name */}
126146
<div class="space-y-2">
127-
<label for="firstName" class="block text-(--color-blue-100) text-sm font-medium">
128-
First Name <span class="text-(--color-blue-200)">*</span>
147+
<label for="firstName" class="block text-content-inverse text-sm font-medium">
148+
First Name <span class="text-content-inverse-active">*</span>
129149
</label>
130150
<input
131151
type="text"
132152
id="firstName"
133153
name="firstName"
134154
autocomplete="given-name"
135-
class="w-full px-4 py-3 border border-(--color-blue-400) rounded-xl bg-blue-800/40 text-white placeholder:text-(--color-blue-300) focus:border-(--color-blue-200) focus:ring-0 focus:outline-none focus-visible:outline-2 focus-visible:outline-white focus-visible:outline-offset-2 focus-visible:rounded-none transition-colors duration-200"
155+
class="w-full rounded-xl bg-page-base px-4 py-3 placeholder:text-content-offset hover:bg-page-offset transition-colors duration-200 focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
136156
required
137157
placeholder="John"
138158
minlength="2"
@@ -142,15 +162,15 @@ const normalizedDownloadUrl = `/downloads/${fileName}`
142162

143163
{/* Last Name */}
144164
<div class="space-y-2">
145-
<label for="lastName" class="block text-(--color-blue-100) text-sm font-medium">
146-
Last Name <span class="text-(--color-blue-200)">*</span>
165+
<label for="lastName" class="block text-content-inverse text-sm font-medium">
166+
Last Name <span class="text-content-inverse-active">*</span>
147167
</label>
148168
<input
149169
type="text"
150170
id="lastName"
151171
name="lastName"
152172
autocomplete="family-name"
153-
class="w-full px-4 py-3 border border-(--color-blue-400) rounded-xl bg-blue-800/40 text-white placeholder:text-(--color-blue-300) focus:border-(--color-blue-200) focus:ring-0 focus:outline-none focus-visible:outline-2 focus-visible:outline-white focus-visible:outline-offset-2 focus-visible:rounded-none transition-colors duration-200"
173+
class="w-full rounded-xl bg-page-base px-4 py-3 placeholder:text-content-offset hover:bg-page-offset transition-colors duration-200 focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
154174
required
155175
placeholder="Doe"
156176
minlength="2"
@@ -161,15 +181,15 @@ const normalizedDownloadUrl = `/downloads/${fileName}`
161181

162182
{/* Work Email */}
163183
<div class="space-y-2">
164-
<label for="workEmail" class="block text-(--color-blue-100) text-sm font-medium">
165-
Work Email <span class="text-(--color-blue-200)">*</span>
184+
<label for="workEmail" class="block text-content-inverse text-sm font-medium">
185+
Work Email <span class="text-content-inverse-active">*</span>
166186
</label>
167187
<input
168188
type="email"
169189
id="workEmail"
170190
name="workEmail"
171191
autocomplete="email"
172-
class="w-full px-4 py-3 border border-(--color-blue-400) rounded-xl bg-blue-800/40 text-white placeholder:text-(--color-blue-300) focus:border-(--color-blue-200) focus:ring-0 focus:outline-none focus-visible:outline-2 focus-visible:outline-white focus-visible:outline-offset-2 focus-visible:rounded-none transition-colors duration-200"
192+
class="w-full rounded-xl bg-page-base px-4 py-3 placeholder:text-content-offset hover:bg-page-offset transition-colors duration-200 focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
173193
required
174194
placeholder="john.doe@company.com"
175195
/>
@@ -184,13 +204,13 @@ const normalizedDownloadUrl = `/downloads/${fileName}`
184204
/>
185205

186206
{/* Privacy Notice */}
187-
<div class="pt-4 border-t border-(--color-blue-500)">
188-
<p class="text-xs text-(--color-blue-100) leading-relaxed">
207+
<div class="pt-4 border-t border-primary-offset/60">
208+
<p class="text-xs text-content-inverse leading-relaxed">
189209
By submitting this form, you agree to receive marketing communications from Webstack
190210
Builders. You can unsubscribe at any time. View our
191211
<a
192212
href="/privacy"
193-
class="text-white underline hover:text-(--color-blue-100) focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-(--color-blue-600) rounded"
213+
class="text-content-inverse underline decoration-current decoration-dotted underline-offset-2 hover:text-content-inverse hover:decoration-current rounded focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
194214
>
195215
Privacy Policy
196216
</a>.
@@ -204,7 +224,7 @@ const normalizedDownloadUrl = `/downloads/${fileName}`
204224
type="submit"
205225
id="downloadSubmitBtn"
206226
text="Download Now"
207-
class="w-full bg-white text-blue-700 font-semibold py-3 px-6 rounded-xl hover:bg-blue-50 focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-(--color-blue-600) transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed normal-case tracking-normal border-0"
227+
class="w-full bg-success-offset text-page-inverse font-semibold py-3 px-6 rounded-xl hover:bg-success focus-visible:bg-success transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed normal-case tracking-normal border-0"
208228
/>
209229
</div>
210230
</Confetti>
@@ -215,7 +235,7 @@ const normalizedDownloadUrl = `/downloads/${fileName}`
215235
href={normalizedDownloadUrl}
216236
target="_blank"
217237
rel="noopener noreferrer"
218-
class="block w-full bg-(--color-green-600) text-white font-semibold py-3 px-6 rounded-xl hover:bg-(--color-green-700) focus:outline-none focus:ring-2 focus:ring-(--color-green-600) focus:ring-offset-2 transition-all duration-200 text-center"
238+
class="block w-full bg-success text-primary-inverse font-semibold py-3 px-6 rounded-xl hover:bg-success-offset focus:outline-none focus:ring-2 focus:ring-success focus:ring-offset-2 focus:ring-offset-page-active transition-all duration-200 text-center"
219239
id="downloadBtn"
220240
>
221241
<Icon icon="download-document" color="inherit" size={5} classes="inline-block mr-2 -mt-1" />

src/content/articles/mtls-certificate-rotation-service-mesh-authentication/download.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ This complete guide teaches you:
2020

2121
<List
2222
variant="check-icons-list"
23+
classes={{
24+
wrapper: "sm:ml-6 sm:mr-12 mb-6",
25+
}}
2326
items={[
2427
{ text: "One-way versus mutual TLS: identity verification at the network layer" },
2528
{ text: "Certificate anatomy: Subject, SANs, validity periods, and Extended Key Usage" },

src/pages/downloads/[...slug].astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const path = `/downloads/${download.id.replace(/\/download$/, '')}`
3333
path={path}
3434
breadcrumbTitle={download.data.title}
3535
section="Downloads"
36+
description=""
3637
>
3738
<DownloadPage download={download} />
3839
</PageLayout>

0 commit comments

Comments
 (0)