From 352a102a6afab9e70cd910488949d7e825dab2e3 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Fri, 5 Jul 2024 12:15:32 -0500 Subject: [PATCH] Make navigation mobile-friendly --- public/style.css | 63 +++++++-- src/rawdata/scss/header.css | 56 ++++++-- src/templates/img/menu.svg | 5 + src/templates/src/include/header-2024.html | 143 ++++++++++++--------- src/templates/src/jams_index.html | 2 +- src/templates/src/landing.html | 2 +- 6 files changed, 187 insertions(+), 84 deletions(-) create mode 100644 src/templates/img/menu.svg diff --git a/public/style.css b/public/style.css index 8e31abb5..a749e253 100644 --- a/public/style.css +++ b/public/style.css @@ -8290,6 +8290,7 @@ header { background-color: var(--bg-header); border-bottom-style: solid; border-bottom-width: var(--border-header); + position: relative; } header .hmn-logo { font-family: "MohaveHMN", sans-serif; @@ -8306,10 +8307,39 @@ header .avatar { width: 1.8rem; height: 1.8rem; } +header .header-nav { + position: absolute; + top: calc(100% + 1px); + left: 0; + width: 100%; + background-color: var(--bg-header); + z-index: 100; +} +@media screen and (min-width: 35em) { + header .header-nav { + display: flex; + flex-direction: column; + position: static; + width: auto; + flex-direction: row; + align-items: center; + background-color: none; + } +} header .header-nav > a, header .header-nav > .root-item > a { - display: block; padding: var(--spacing-3); + border-bottom: var(--border-header) solid var(--border-color); +} +header .header-nav > a:not(.db), +header .header-nav > .root-item > a:not(.db) { + display: block; +} +@media screen and (min-width: 35em) { + header .header-nav > a, + header .header-nav > .root-item > a { + border-bottom: none; + } } header .root-item { position: relative; @@ -8317,22 +8347,33 @@ header .root-item { header .submenu { display: flex; flex-direction: column; - position: absolute; - z-index: 100; - min-width: 8rem; - background-color: var(--bg-header); - border-style: solid; - border-width: var(--border-header); - border-top-width: 0; - top: 100%; +} +@media screen and (min-width: 35em) { + header .submenu { + position: absolute; + z-index: 100; + min-width: 8rem; + background-color: var(--bg-header); + border-style: solid; + border-width: var(--border-header); + border-top-width: 0; + top: 100%; + } } header .submenu > a { - padding: var(--spacing-2) var(--spacing-3); + padding: var(--spacing-2) var(--spacing-3) var(--spacing-2) var(--spacing-4); display: block; white-space: nowrap; z-index: 1; + border-bottom: var(--border-header) solid var(--border-color); } -header .root-item:not(:hover):not(.clicked) > .submenu { +@media screen and (min-width: 35em) { + header .submenu > a { + padding: var(--spacing-2) var(--spacing-3); + border-bottom: none; + } +} +header .root-item:not(:hover):not(.clicked) .submenu { display: none; } header .root-item.clicked .svgicon { diff --git a/src/rawdata/scss/header.css b/src/rawdata/scss/header.css index b2a57251..9465b311 100644 --- a/src/rawdata/scss/header.css +++ b/src/rawdata/scss/header.css @@ -120,6 +120,7 @@ header { background-color: var(--bg-header); border-bottom-style: solid; border-bottom-width: var(--border-header); + position: relative; .hmn-logo { font-family: 'MohaveHMN', sans-serif; @@ -141,11 +142,35 @@ header { } .header-nav { + position: absolute; + top: calc(100% + 1px); + left: 0; + width: 100%; + background-color: var(--bg-header); + z-index: 100; + + @media screen and (min-width: 35em) { + display: flex; + flex-direction: column; + position: static; + width: auto; + flex-direction: row; + align-items: center; + background-color: none; + } >a, >.root-item>a { - display: block; + &:not(.db) { + display: block; + } + padding: var(--spacing-3); + border-bottom: var(--border-header) solid var(--border-color); + + @media screen and (min-width: 35em) { + border-bottom: none; + } } } @@ -156,25 +181,34 @@ header { .submenu { display: flex; flex-direction: column; - position: absolute; - z-index: 100; - min-width: 8rem; - background-color: var(--bg-header); - border-style: solid; - border-width: var(--border-header); - border-top-width: 0; - top: 100%; + + @media screen and (min-width: 35em) { + position: absolute; + z-index: 100; + min-width: 8rem; + background-color: var(--bg-header); + border-style: solid; + border-width: var(--border-header); + border-top-width: 0; + top: 100%; + } >a { - padding: var(--spacing-2) var(--spacing-3); + padding: var(--spacing-2) var(--spacing-3) var(--spacing-2) var(--spacing-4); display: block; white-space: nowrap; z-index: 1; + border-bottom: var(--border-header) solid var(--border-color); + + @media screen and (min-width: 35em) { + padding: var(--spacing-2) var(--spacing-3); + border-bottom: none; + } } } .root-item { - &:not(:hover):not(.clicked)>.submenu { + &:not(:hover):not(.clicked) .submenu { display: none; } diff --git a/src/templates/img/menu.svg b/src/templates/img/menu.svg new file mode 100644 index 00000000..d1c74bff --- /dev/null +++ b/src/templates/img/menu.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/templates/src/include/header-2024.html b/src/templates/src/include/header-2024.html index d94fb2cc..400953c5 100644 --- a/src/templates/src/include/header-2024.html +++ b/src/templates/src/include/header-2024.html @@ -1,11 +1,11 @@ {{ if and .Header.BannerEvent (not .Header.SuppressBanners) }} - {{ with .Header.BannerEvent }} - {{ if eq .Slug "VJ2024" }} - - Visibility Jam. - July 19-21, 2024. - {{ if gt .DaysUntilEnd 0 }} - {{ if eq .DaysUntilStart 0 }} - Happening now. - {{ else if eq .DaysUntilStart 1 }} - Starting tomorrow. - {{ else }} - In {{ .DaysUntilStart }} days. - {{ end }} - {{ else }} - See the results. - {{ end }} - - {{ end }} - {{ end }} +{{ with .Header.BannerEvent }} +{{ if eq .Slug "VJ2024" }} + +Visibility Jam. +July 19-21, 2024. +{{ if gt .DaysUntilEnd 0 }} +{{ if eq .DaysUntilStart 0 }} +Happening now. +{{ else if eq .DaysUntilStart 1 }} +Starting tomorrow. +{{ else }} +In {{ .DaysUntilStart }} days. +{{ end }} +{{ else }} +See the results. +{{ end }} + +{{ end }} +{{ end }} {{ end }} diff --git a/src/templates/src/jams_index.html b/src/templates/src/jams_index.html index f299d4ee..ac523a6c 100644 --- a/src/templates/src/jams_index.html +++ b/src/templates/src/jams_index.html @@ -18,7 +18,7 @@
- +
diff --git a/src/templates/src/landing.html b/src/templates/src/landing.html index d6d093ae..94f1f81d 100644 --- a/src/templates/src/landing.html +++ b/src/templates/src/landing.html @@ -85,7 +85,7 @@
-
+
{{ if .User }}