fix: Keeps logo size and resolves mobile menu overlap
This commit is contained in:
parent
91f48051fd
commit
401f1ce11a
5 changed files with 157 additions and 16 deletions
|
|
@ -16,6 +16,13 @@ hugo server --buildFuture --buildDrafts
|
||||||
|
|
||||||
Then open http://localhost:1313
|
Then open http://localhost:1313
|
||||||
|
|
||||||
|
The header uses the logo dimensions in `hugo.yaml` in both languages, without
|
||||||
|
shrinking the logo to fit the text. With JavaScript enabled, screens up to 666px
|
||||||
|
wide use a flat, borderless full-width menu button at the bottom and a scrollable
|
||||||
|
panel above it. The language link spans the panel's content width, includes the
|
||||||
|
translation icon, and uses the same font size as the menu links.
|
||||||
|
The page reserves space for the button so it does not cover content.
|
||||||
|
|
||||||
## Shortcode: Language badge
|
## Shortcode: Language badge
|
||||||
|
|
||||||
Use the `lang` shortcode to mark whether a tour is in German, English or bilingual. It renders a small superscript badge next to the text, with details when hovered over or parsed by a screenreader.
|
Use the `lang` shortcode to mark whether a tour is in German, English or bilingual. It renders a small superscript badge next to the text, with details when hovered over or parsed by a screenreader.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,122 @@
|
||||||
@import './_schedule.css';
|
@import './_schedule.css';
|
||||||
@import './_gallery.css';
|
@import './_gallery.css';
|
||||||
|
|
||||||
|
.header__logo {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header__intro {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (width <= 666px) {
|
||||||
|
.header {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reserve space for the mobile menu without changing the theme's colours or fonts. */
|
||||||
|
:root {
|
||||||
|
--mobile-bar-h: 3.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout__page:has(> .mobile-nav:not([hidden])) {
|
||||||
|
padding-block-end: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom, 0px));
|
||||||
|
}
|
||||||
|
|
||||||
|
:root:has(.mobile-nav:not([hidden])) {
|
||||||
|
scroll-padding-block-end: calc(var(--mobile-bar-h) + 1rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-nav {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-nav__cover {
|
||||||
|
inset: 0;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-nav__toggle.button {
|
||||||
|
position: fixed;
|
||||||
|
inset: auto 0 0;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.6rem;
|
||||||
|
width: auto;
|
||||||
|
block-size: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom, 0px));
|
||||||
|
padding: 0 var(--gutters) env(safe-area-inset-bottom, 0px);
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
background: var(--color-button);
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible,
|
||||||
|
&:active {
|
||||||
|
background: var(--color-button-hover);
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus-visible {
|
||||||
|
outline-offset: -4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-nav__sheet {
|
||||||
|
position: absolute;
|
||||||
|
inset: auto 0 calc(var(--mobile-bar-h) + env(safe-area-inset-bottom, 0px));
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
max-height: calc(100% - var(--mobile-bar-h) - env(safe-area-inset-bottom, 0px) - var(--spacing-l));
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: var(--spacing-m) var(--gutters);
|
||||||
|
transform: translateY(100%);
|
||||||
|
|
||||||
|
[data-navopen] & {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-nav__region .language-selector ul {
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.language-selector a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.45em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.language-selector .language-icon {
|
||||||
|
inline-size: 1.1em;
|
||||||
|
block-size: 1.1em;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin: 0;
|
||||||
|
fill: currentcolor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-nav__region .language-selector {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-nav__region .language-selector a,
|
||||||
|
.mobile-nav__navbar a {
|
||||||
|
padding-block: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-nav__region .language-selector a {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-nav__navbar a {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.header__intro_headline {
|
.header__intro_headline {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font: bold var(--fs-xxl) "Arial";
|
font: bold var(--fs-xxl) "Arial";
|
||||||
|
|
@ -45,18 +161,19 @@ th, td {
|
||||||
--color-mobile-menu: #141414;
|
--color-mobile-menu: #141414;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav ul li {
|
}
|
||||||
flex-grow: 1;
|
|
||||||
text-align: center;
|
nav ul li {
|
||||||
}
|
flex-grow: 1;
|
||||||
.main-menu a:active {
|
text-align: center;
|
||||||
text-decoration: none;
|
}
|
||||||
}
|
.main-menu a:active {
|
||||||
/* Links in text keep their underline: the link colour alone is too close to the text colour. */
|
text-decoration: none;
|
||||||
nav a,
|
}
|
||||||
.header a {
|
/* Links in text keep their underline: the link colour alone is too close to the text colour. */
|
||||||
text-decoration: none;
|
nav a,
|
||||||
}
|
.header a {
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 a {
|
h2 a {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ params:
|
||||||
headline: Willkommen bei Hamburg Hackertours!
|
headline: Willkommen bei Hamburg Hackertours!
|
||||||
intro: |
|
intro: |
|
||||||
Für den Congress und für das Easterhegg organisiert der CCC Hamburg Touren zu interessanten Orten in und um Hamburg. Hier findet ihr Informationen zu aktuellen und vergangenen Veranstaltungen!
|
Für den Congress und für das Easterhegg organisiert der CCC Hamburg Touren zu interessanten Orten in und um Hamburg. Hier findet ihr Informationen zu aktuellen und vergangenen Veranstaltungen!
|
||||||
logowidth: 500
|
|
||||||
logoheight: 500
|
|
||||||
cascade:
|
cascade:
|
||||||
params:
|
params:
|
||||||
intro: Wir von Hamburg Hackertours zeigen euch die Stadt!
|
intro: Wir von Hamburg Hackertours zeigen euch die Stadt!
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ params:
|
||||||
headline: Welcome to Hackertours!
|
headline: Welcome to Hackertours!
|
||||||
intro: |
|
intro: |
|
||||||
For Congress and for Easterhegg CCC Hamburg is organizing tours to interesting places in and around Hamburg. Here you will find information about current and past events!
|
For Congress and for Easterhegg CCC Hamburg is organizing tours to interesting places in and around Hamburg. Here you will find information about current and past events!
|
||||||
logowidth: 500
|
|
||||||
logoheight: 500
|
|
||||||
cascade:
|
cascade:
|
||||||
params:
|
params:
|
||||||
intro: We at Hamburg Hackertours show you around the city!
|
intro: We at Hamburg Hackertours show you around the city!
|
||||||
|
|
|
||||||
21
layouts/_partials/language-selector.html
Normal file
21
layouts/_partials/language-selector.html
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{{- /* Keep the translation icon inside the link so the entire language row is clickable.
|
||||||
|
Compare with the theme's language-selector.html after updating Zen. */ -}}
|
||||||
|
{{- $icon := `<svg version="1.0" xmlns="http://www.w3.org/2000/svg" class="language-icon" width="24" height="24" viewBox="0 0 961 1113" aria-hidden="true" focusable="false">
|
||||||
|
<path d="M848 3a17654 17654 0 00-349 118l-39 13-6 2-171-60-173-62c-2 0-2 6-2 118v119l-50 16-53 19c-5 3-5-19-5 343 0 335 0 336 2 339l6 5a92499 92499 0 00459-150l12-4 10 3 467 148 4 2V302l-45-15-45-14-1-132c0-124-1-132-2-134-4-7-9-8-19-5zm-4 145l-1 117-178-57-178-57L843 30l1 118zM458 481l-1 319-216 72-216 72V305l215-72 217-72 1 320zm262-131c17 4 30 9 30 9 1 0 20 67 42 149l57 203 15 56-64-19a2060 2060 0 01-24-84 2094 2094 0 00-130-40l-15 33-14 34-64-18 22-55 55-136 46-112c10-24 13-30 14-30l31 10z"/>
|
||||||
|
<path d="M257 360l-35 9c-23 7-25 7-34 7a72 72 0 01-20-3c-1 1 2 11 5 18 4 8 13 17 23 21 6 3 7 3 18 3 19 0 37-6 52-17 12-8 16-18 15-29-2-11-8-13-24-9zM335 413l-35 16c-13 7-23 12-28 13l-38 12a1636 1636 0 01-106 32c-19 3-17 2-17 9l2 8c2 4 9 10 14 12 12 6 42 3 51-6 2-2 3-3 3-7v-6l31-10 40-11a515 515 0 0148-13l-48 96c-10 19-23 40-45 71l-52 71-55 64-7 8h4c7 0 17-2 20-4a929 929 0 00149-179l23 17c26 20 30 23 51 35 25 14 39 21 56 27 8 2 12 3 13 1 1-4-6-30-9-33l-26-12-47-20-40-17-16-7 10-17c22-35 34-56 53-95l20-40 1-10v-11h-3l-17 6zM716 451l-23 56-23 55 86 26a4814 4814 0 00-40-137zM680 972a460 460 0 0026 44 422 422 0 01-319 66 517 517 0 01-175-66c-7-3-14-2-17 4-2 3-2 9 0 12s24 16 46 27a536 536 0 00222 53c36 1 39 0 68-4a480 480 0 00181-65l8-5 12 21 13 19 7-19 17-48 10-32-99-7z"/>
|
||||||
|
</svg>` -}}
|
||||||
|
<nav class="language-selector layout__language-selector" aria-label="{{ i18n "lang_select_title" }}">
|
||||||
|
<ul class="flex-inline mx--0">
|
||||||
|
{{ if .IsTranslated -}}
|
||||||
|
{{ range .Translations -}}
|
||||||
|
<li><a rel="alternate" href="{{ .RelPermalink }}" hreflang="{{ .Site.Language.Locale | default .Language.Name }}" lang="{{ .Site.Language.Locale | default .Language.Name }}">{{ $icon | safeHTML }}<span>{{ .Language.Label }}</span></a></li>
|
||||||
|
{{ end -}}
|
||||||
|
{{ else -}}
|
||||||
|
{{ range hugo.Sites -}}
|
||||||
|
{{ if ne $.Language.Name .Language.Name -}}
|
||||||
|
<li><a rel="alternate" href="{{ .Home.RelPermalink }}" hreflang="{{ .Language.Locale | default .Language.Name }}" lang="{{ .Language.Locale | default .Language.Name }}">{{ $icon | safeHTML }}<span>{{ .Language.Label }}</span></a></li>
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
Loading…
Reference in a new issue