Show day picker on desktop schedules

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Vincent Mahnke 2026-11-14 03:17:19 +01:00
commit f53721555f
Signed by: ViMaSter
GPG key ID: 6D787326BA7D6469
3 changed files with 89 additions and 60 deletions

View file

@ -1,4 +1,4 @@
/* Tour schedule shortcode: one column of cards per day, a day picker on narrow screens. */
/* Tour schedule shortcode: a day picker, with a grid fallback on wide screens without JavaScript. */
.schedule {
--schedule-line: color-mix(in oklch, var(--color-text) 20%, transparent);
@ -196,74 +196,104 @@
}
}
/* The picker only exists with JavaScript and is only used on narrow screens. */
/* The picker is only shown with JavaScript. */
.schedule__picker {
display: none;
}
@container (width < 48rem) {
/* Keeps a focused card from scrolling under the sticky day picker. */
.schedule__title {
scroll-margin-block-start: 6rem;
}
/* Keeps a focused card from scrolling under the sticky day picker. */
.schedule__title {
scroll-margin-block-start: 6rem;
}
.schedule__picker:not([hidden]) {
position: sticky;
inset-block-start: 0;
z-index: 2;
display: flex;
gap: 0.25rem;
margin-block-end: 1rem;
padding: 0.25rem;
border-radius: var(--radius-l);
background: var(--color-body-bg);
box-shadow: inset 0 0 0 1px var(--schedule-line);
}
.schedule__picker:not([hidden]) {
position: sticky;
inset-block-start: 0;
z-index: 2;
display: flex;
gap: 0.25rem;
margin-block-end: 1rem;
padding: 0.25rem;
border-radius: var(--radius-l);
background: var(--color-body-bg);
box-shadow: inset 0 0 0 1px var(--schedule-line);
}
.schedule__pick {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
padding: 0.35rem 0.25rem;
border: 0;
border-radius: var(--radius-m);
background: transparent;
color: var(--color-text);
font-family: var(--ff-alt);
font-size: var(--fs-s);
font-weight: bold;
cursor: pointer;
.schedule__pick {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
padding: 0.35rem 0.25rem;
border: 0;
border-radius: var(--radius-m);
background: transparent;
color: var(--color-text);
font-family: var(--ff-alt);
font-size: var(--fs-s);
font-weight: bold;
cursor: pointer;
&[aria-pressed="true"] {
background: var(--schedule-accent);
color: var(--color-body-bg);
&[aria-pressed="true"] {
background: var(--schedule-accent);
color: var(--color-body-bg);
.schedule__pick-date {
color: inherit;
}
.schedule__pick-date {
color: inherit;
}
}
}
.schedule__pick-date {
font-size: var(--fs-xs);
font-weight: normal;
color: var(--color-text-meta);
.schedule__pick-date {
font-size: var(--fs-xs);
font-weight: normal;
color: var(--color-text-meta);
}
.schedule--picker {
.schedule__day:not(.schedule__day--selected) {
display: none;
}
/* The picker already names the day. */
.schedule__day-title {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
}
@container (width >= 48rem) {
.schedule--picker {
.schedule__day:not(.schedule__day--selected) {
display: none;
.schedule__days {
display: block;
}
.schedule__day {
display: block;
}
.schedule__list {
grid-template-rows: none;
}
.schedule__card {
grid-row: auto;
}
.schedule__title {
display: block;
-webkit-line-clamp: unset;
line-clamp: unset;
overflow: visible;
min-height: 0;
}
/* The picker already names the day. */
.schedule__day-title {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
.schedule__hour {
display: none;
}
}
}

View file

@ -1,5 +1,4 @@
// Day picker for the schedule shortcode. The CSS only uses it on narrow screens;
// without JavaScript all days stack vertically there.
// Day picker for the schedule shortcode. Without JavaScript all days remain visible.
for (const schedule of document.querySelectorAll('[data-schedule]')) {
const picker = schedule.querySelector('.schedule__picker');
const buttons = [...picker.querySelectorAll('button')];

View file

@ -1,6 +1,6 @@
{{- /*
Tour schedule from data/schedule/<event>.yaml, one column of tour cards per day.
On narrow screens the days stack; with JavaScript a day picker shows one day at a time.
Tour schedule from data/schedule/<event>.yaml.
With JavaScript a day picker shows one day at a time; without it all days are visible.
Usage: {{< schedule >}} on a section page (the event is the section name),
or {{< schedule 39c3 >}}.