Few seats left: mark tours as a whole, highlight in amber
The schedule badges tours listed in the data file's fewseats list below their title; tour lists and the tour-map list badge pages with params.fewseats. The date note is now an amber highlight. Shared i18n key fewseats and partial fewseats-badge.html.
This commit is contained in:
parent
7815564078
commit
6a140235fa
10 changed files with 80 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
|||
@import './_schedule.css';
|
||||
@import './_schedule-40c3.css';
|
||||
@import './_tour-map.css';
|
||||
@import './_fewseats.css';
|
||||
@import './_gallery.css';
|
||||
@import './_events.css';
|
||||
|
||||
|
|
@ -513,3 +514,15 @@ span.content-image {
|
|||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
/* "Only a few seats left" (themes/hackertours/assets/css/_fewseats.css): the 40C3 amber and ink. */
|
||||
:root {
|
||||
--fewseats: var(--c40-amber);
|
||||
--fewseats-text: var(--c40-ink);
|
||||
}
|
||||
|
||||
/* Square, like the language badges. */
|
||||
.schedule__status--fewseats,
|
||||
.fewseats-badge {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
@import './_schedule.css';
|
||||
@import './_tour-map.css';
|
||||
@import './_fewseats.css';
|
||||
@import './_gallery.css';
|
||||
@import './_events.css';
|
||||
|
||||
|
|
|
|||
31
themes/hackertours/assets/css/_fewseats.css
Normal file
31
themes/hackertours/assets/css/_fewseats.css
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/* "Only a few seats left": amber highlight with dark text, which keeps its contrast on the
|
||||
light and the dark page background. The date note in the schedule is filled
|
||||
(_schedule.css); the badge for a tour as a whole is tinted, with an amber outline. */
|
||||
:root {
|
||||
--fewseats: #ffbc40;
|
||||
--fewseats-text: #001300;
|
||||
}
|
||||
|
||||
.fewseats-badge {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
padding: 0 0.4rem;
|
||||
border: 1px solid var(--fewseats);
|
||||
border-radius: 999px;
|
||||
background: color-mix(in oklch, var(--fewseats) 22%, transparent);
|
||||
color: var(--color-text);
|
||||
font-family: var(--ff-alt);
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: normal;
|
||||
letter-spacing: normal;
|
||||
line-height: 1.5;
|
||||
text-decoration: none;
|
||||
text-transform: none;
|
||||
text-wrap: balance;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Next to a tour title in the lists: it moves below a long title as a whole. */
|
||||
.fewseats-badge--title {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
|
@ -196,17 +196,29 @@
|
|||
color: var(--color-text-meta);
|
||||
}
|
||||
|
||||
/* Only a few seats left: a quieter note than "fully booked", in the case the tour pages
|
||||
use. If it doesn't fit next to the time it moves below it as a whole, and only breaks
|
||||
(in balanced lines) when the card is narrower than the note. */
|
||||
/* Only a few seats left on this date: an amber highlight (_fewseats.css), in the case the
|
||||
tour pages use. If it doesn't fit next to the time it moves below it as a whole, and only
|
||||
breaks (in balanced lines) when the card is narrower than the note. */
|
||||
.schedule__status--fewseats {
|
||||
min-width: 0;
|
||||
padding: 0 0.4rem;
|
||||
border-radius: var(--radius-s);
|
||||
background: var(--fewseats);
|
||||
color: var(--fewseats-text);
|
||||
font-weight: normal;
|
||||
letter-spacing: normal;
|
||||
text-transform: none;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
/* The tour as a whole has only a few seats left: a badge below the title. It stays under
|
||||
the card-wide link, so clicking it opens the tour. */
|
||||
.schedule__fewseats {
|
||||
grid-column: 1 / -1;
|
||||
justify-self: start;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Fully booked: still listed and linked, but muted. */
|
||||
.schedule__card--soldout {
|
||||
border-inline-start-color: var(--schedule-line);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ book_now: "Jetzt buchen"
|
|||
calendar_meeting_point: "Hackertours-Desk"
|
||||
calendar_ics: "iCal Download"
|
||||
calendar_google: "Google Calendar"
|
||||
fewseats: "Nur wenige Plätze über"
|
||||
gallery_enlarge: "Großansicht"
|
||||
gallery_dialog: "Bildansicht"
|
||||
gallery_close: "Schließen"
|
||||
|
|
@ -11,7 +12,6 @@ logo_alt: "Hamburg Hackertours – Startseite"
|
|||
map_39c3_title: "Karte der 39C3-Touren mit Wegen vom CCH (uMap)"
|
||||
schedule_day: "Tag {{ .Day }}"
|
||||
schedule_pick_day: "Tag auswählen"
|
||||
schedule_fewseats: "Nur wenige Plätze über"
|
||||
schedule_soldout: "ausgebucht"
|
||||
skip_to_content: "Zum Inhalt springen"
|
||||
tour_map_label: "Karte der Tourorte"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ book_now: "Book now"
|
|||
calendar_ics: "iCal download"
|
||||
calendar_google: "Google calendar"
|
||||
calendar_meeting_point: "Hackertours Desk"
|
||||
fewseats: "only a few seats left"
|
||||
gallery_enlarge: "enlarge"
|
||||
gallery_dialog: "Image viewer"
|
||||
gallery_close: "Close"
|
||||
|
|
@ -11,7 +12,6 @@ logo_alt: "Hamburg Hackertours – home page"
|
|||
map_39c3_title: "Map of the 39C3 tours with routes from the CCH (uMap)"
|
||||
schedule_day: "Day {{ .Day }}"
|
||||
schedule_pick_day: "Choose a day"
|
||||
schedule_fewseats: "only a few seats left"
|
||||
schedule_soldout: "fully booked"
|
||||
skip_to_content: "Skip to content"
|
||||
tour_map_label: "Map of the tour locations"
|
||||
|
|
|
|||
3
themes/hackertours/layouts/_partials/fewseats-badge.html
Normal file
3
themes/hackertours/layouts/_partials/fewseats-badge.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{{- /* "Only a few seats left" badge for a tour as a whole (front matter params.fewseats, or the
|
||||
fewseats list in data/schedule/<event>.yaml). Param: class (optional, added to fewseats-badge). */ -}}
|
||||
<span class="fewseats-badge{{ with .class }} {{ . }}{{ end }}">{{ i18n "fewseats" }}</span>
|
||||
|
|
@ -9,9 +9,14 @@ or {{< schedule 39c3 >}}.
|
|||
{{- /* A missing or empty data file, or one without tours, renders nothing but a warning. */ -}}
|
||||
{{- $file := false -}}
|
||||
{{- $days := slice -}}
|
||||
{{- /* Tours (by slug) with only a few seats left as a whole; dates have their own status. */ -}}
|
||||
{{- $fewSeatsTours := slice -}}
|
||||
{{- with hugo.Data.schedule -}}
|
||||
{{- if isset . $event }}{{ $file = true }}{{ end -}}
|
||||
{{- with index . $event }}{{ with .days }}{{ $days = . }}{{ end }}{{ end -}}
|
||||
{{- with index . $event }}
|
||||
{{- with .days }}{{ $days = . }}{{ end -}}
|
||||
{{- with .fewseats }}{{ if reflect.IsSlice . }}{{ $fewSeatsTours = . }}{{ end }}{{ end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $tourCount := 0 -}}
|
||||
{{- range $days }}{{ with .tours }}{{ $tourCount = add $tourCount (len .) }}{{ end }}{{ end -}}
|
||||
|
|
@ -105,7 +110,7 @@ so an hour without tours still gets a row.
|
|||
{{- if $soldOut }}
|
||||
<span class="schedule__status">{{ i18n "schedule_soldout" }}</span>
|
||||
{{- else if $fewSeats }}
|
||||
<span class="schedule__status schedule__status--fewseats">{{ i18n "schedule_fewseats" }}</span>
|
||||
<span class="schedule__status schedule__status--fewseats">{{ i18n "fewseats" }}</span>
|
||||
{{- end }}
|
||||
</span>
|
||||
{{- with .lang }}
|
||||
|
|
@ -117,6 +122,9 @@ so an hour without tours still gets a row.
|
|||
{{- else }}
|
||||
<span class="schedule__title">{{ $ownTitle | default $entry.tour }}</span>
|
||||
{{- end }}
|
||||
{{- if in $fewSeatsTours $entry.tour }}
|
||||
<span class="schedule__fewseats">{{ partial "fewseats-badge.html" dict }}</span>
|
||||
{{- end }}
|
||||
{{- with $photo }}
|
||||
<figure class="schedule__photo">
|
||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $photoAlt }}" loading="lazy" decoding="async">
|
||||
|
|
|
|||
|
|
@ -19,9 +19,11 @@ or {{< tour-map 39c3 >}}.
|
|||
{{- with $tour.geo -}}
|
||||
{{- $title := $slug -}}
|
||||
{{- $url := "" -}}
|
||||
{{- $fewSeats := false -}}
|
||||
{{- with $.Page.GetPage $slug -}}
|
||||
{{- $title = .LinkTitle | replaceRE $prefix "" -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- $fewSeats = eq .Params.fewseats true -}}
|
||||
{{- else -}}
|
||||
{{- warnf "tour-map: %s: no page for tour %q" $event $slug -}}
|
||||
{{- end -}}
|
||||
|
|
@ -39,6 +41,7 @@ or {{< tour-map 39c3 >}}.
|
|||
{{- $tours = $tours | append (dict
|
||||
"title" $title
|
||||
"url" $url
|
||||
"fewseats" $fewSeats
|
||||
"lat" .lat
|
||||
"lon" .lon
|
||||
"color" ($tour.color | default "")
|
||||
|
|
@ -71,6 +74,7 @@ or {{< tour-map 39c3 >}}.
|
|||
{{- range $tours }}
|
||||
<li>
|
||||
{{- if .url }}<a href="{{ .url }}">{{ .title }}</a>{{ else }}{{ .title }}{{ end }}
|
||||
{{- if .fewseats }} {{ partial "fewseats-badge.html" dict }}{{ end }}
|
||||
(<a href="https://www.openstreetmap.org/?mlat={{ .lat }}&mlon={{ .lon }}#map=17/{{ .lat }}/{{ .lon }}">{{ i18n "tour_map_osm" }}</a>)
|
||||
{{- with .directions }}{{ . }}{{ end }}
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
{{- if .Param "showPostDate" | default false }}
|
||||
{{- $postDate = .Params.date.Format .Site.Params.dateFormat }}
|
||||
{{- end }}
|
||||
<h2 class="title mt--s{{ if $.Param "submitted" | default false }} mb--xxs{{ end }}"><a href="{{ .RelPermalink }}">{{ .Title }}</a> <span class="title-post-date">{{ $postDate }}</span></h2>
|
||||
<h2 class="title mt--s{{ if $.Param "submitted" | default false }} mb--xxs{{ end }}"><a href="{{ .RelPermalink }}">{{ .Title }}</a>{{ if eq .Params.fewseats true }} {{ partial "fewseats-badge.html" (dict "class" "fewseats-badge--title") }}{{ end }} <span class="title-post-date">{{ $postDate }}</span></h2>
|
||||
{{ if $.Param "submitted" | default false }}{{ partial "submitted.html" . -}}{{ end }}
|
||||
</header>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue