Skip to content

Commit 2aa06eb

Browse files
committed
feat(event): show supplementary links in detail sidebar
Surfaces the new event link fields from sanity PR #242 (registration, code of conduct, accessibility info, schedule, call for speakers) inside the event detail sidebar card, below the existing 'Event website' button. Accessibility info renders link + summary together when both are present, associated via aria-describedby so the summary is announced as the link's description. When only a summary exists, it renders as plain text in the list. Also fixes a pre-existing gap on the 'Event website' button: external link indication was visual only. Added sr-only '(opens external site)' text to match the pattern used in StaticEvent.astro.
1 parent 2ec31be commit 2aa06eb

2 files changed

Lines changed: 107 additions & 1 deletion

File tree

src/pages/events/[slug].astro

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,31 @@ const enumeratedChildTypes = (() => {
109109
return `${joined} at ${event.title}`;
110110
})();
111111
112+
// Supplementary sidebar links
113+
const supplementaryLinks = [
114+
event.registration && { href: event.registration, label: 'Registration' },
115+
event.codeOfConduct && {
116+
href: event.codeOfConduct,
117+
label: 'Code of conduct',
118+
},
119+
event.accessibilityInfo?.url && {
120+
href: event.accessibilityInfo.url,
121+
label: 'Accessibility information',
122+
summary: event.accessibilityInfo.summary,
123+
},
124+
event.schedule && { href: event.schedule, label: 'Schedule' },
125+
event.callForSpeakersLink && {
126+
href: event.callForSpeakersLink,
127+
label: 'Call for speakers',
128+
},
129+
].filter(Boolean) as Array<{ href: string; label: string; summary?: string }>;
130+
131+
const hasAccessibilitySummaryOnly =
132+
event.accessibilityInfo?.summary && !event.accessibilityInfo?.url;
133+
134+
const hasSidebarLinks =
135+
supplementaryLinks.length > 0 || hasAccessibilitySummaryOnly;
136+
112137
// JSON-LD structured data
113138
const jsonLd = {
114139
'@context': 'https://schema.org',
@@ -302,7 +327,7 @@ const jsonLd = {
302327

303328
<div class="event-detail-body">
304329
{
305-
(event.website || event.organizer) && (
330+
(event.website || event.organizer || hasSidebarLinks) && (
306331
<aside class="event-detail-sidebar">
307332
<wa-card class="event-detail-sidebar__card" appearance="outlined">
308333
<p>
@@ -371,9 +396,64 @@ const jsonLd = {
371396
style="width: 100%;"
372397
>
373398
Event website
399+
<span class="sr-only"> (opens external site)</span>
374400
<wa-icon slot="end" name="arrow-up-right-from-square" />
375401
</wa-button>
376402
)}
403+
{hasSidebarLinks && (
404+
<>
405+
<h2 class="sr-only">Event resources</h2>
406+
<ul role="list" class="event-detail-sidebar__links">
407+
{supplementaryLinks.map((link) =>
408+
link.label === 'Accessibility information' &&
409+
link.summary ? (
410+
<li>
411+
<a
412+
href={link.href}
413+
rel="noopener noreferrer"
414+
target="_blank"
415+
aria-describedby="a11y-info-summary"
416+
>
417+
{link.label}
418+
<wa-icon
419+
name="arrow-up-right-from-square"
420+
label="(opens external site)"
421+
/>
422+
</a>
423+
<p
424+
id="a11y-info-summary"
425+
class="text-small text-muted"
426+
>
427+
{link.summary}
428+
</p>
429+
</li>
430+
) : (
431+
<li>
432+
<a
433+
href={link.href}
434+
rel="noopener noreferrer"
435+
target="_blank"
436+
>
437+
{link.label}
438+
<wa-icon
439+
name="arrow-up-right-from-square"
440+
label="(opens external site)"
441+
/>
442+
</a>
443+
</li>
444+
)
445+
)}
446+
{hasAccessibilitySummaryOnly &&
447+
!event.accessibilityInfo?.url && (
448+
<li>
449+
<p class="text-small text-muted">
450+
Accessibility: {event.accessibilityInfo!.summary}
451+
</p>
452+
</li>
453+
)}
454+
</ul>
455+
</>
456+
)}
377457
</wa-card>
378458
</aside>
379459
)
@@ -583,6 +663,27 @@ const jsonLd = {
583663
margin-top: var(--p-space-xs);
584664
}
585665

666+
.event-detail-sidebar__links {
667+
list-style: none;
668+
padding: 0;
669+
margin-top: var(--p-space-xs);
670+
padding-top: var(--p-space-xs);
671+
border-top: 1px solid var(--s-color-border);
672+
display: flex;
673+
flex-direction: column;
674+
gap: var(--p-space-2xs);
675+
}
676+
677+
.event-detail-sidebar__links a {
678+
display: inline-flex;
679+
align-items: center;
680+
gap: var(--p-space-3xs);
681+
}
682+
683+
.event-detail-sidebar__links p {
684+
margin: var(--p-space-3xs) 0 0;
685+
}
686+
586687
@media (min-width: 769px) {
587688
.event-detail {
588689
max-width: none;

src/types/event.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export interface Event {
5252
location?: string;
5353
isFree?: boolean;
5454
website?: string;
55+
registration?: string;
56+
codeOfConduct?: string;
57+
accessibilityInfo?: { url?: string; summary?: string };
58+
schedule?: string;
59+
callForSpeakersLink?: string;
5560
parent?: { _ref: string };
5661
parentEvent?: { title: string; slug?: { current: string } };
5762
children?: ChildEvent[];

0 commit comments

Comments
 (0)