From 63478685e83f76d4306a34cf7f751d554f871281 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 3 Apr 2023 17:20:42 -0400 Subject: [PATCH] Hide menu navigation on mobile, disable text decoration on links --- themes/red/assets/css/site.css | 6 +++++- themes/red/assets/js/gallery.js | 8 ++++++++ themes/red/assets/js/site.js | 11 +++-------- themes/red/layouts/_default/baseof.html | 6 ++++++ themes/red/layouts/_default/gallery.html | 2 +- themes/red/layouts/partials/art-gallery.html | 2 +- themes/red/layouts/partials/art-years.html | 2 +- themes/red/layouts/partials/featured-art.html | 2 +- themes/red/layouts/partials/render-art.html | 2 +- themes/red/layouts/partials/sidebar.html | 15 +++++++++------ 10 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 themes/red/assets/js/gallery.js diff --git a/themes/red/assets/css/site.css b/themes/red/assets/css/site.css index 3bfaf9e..9c2690f 100644 --- a/themes/red/assets/css/site.css +++ b/themes/red/assets/css/site.css @@ -418,4 +418,8 @@ pre { border-radius: 5px; padding: 5px; text-align: center; -} \ No newline at end of file +} + +.no-decoration { + text-decoration: none; +} diff --git a/themes/red/assets/js/gallery.js b/themes/red/assets/js/gallery.js new file mode 100644 index 0000000..8757b26 --- /dev/null +++ b/themes/red/assets/js/gallery.js @@ -0,0 +1,8 @@ +imagesLoaded(document.querySelector('.grid'), function(instance) { + new Masonry('.grid', { + itemSelector: '.grid-item', + columnWidth: '.grid-sizer', + fitWidth: true, + gutter: 10, + }); +}); diff --git a/themes/red/assets/js/site.js b/themes/red/assets/js/site.js index 8757b26..efbbd2b 100644 --- a/themes/red/assets/js/site.js +++ b/themes/red/assets/js/site.js @@ -1,8 +1,3 @@ -imagesLoaded(document.querySelector('.grid'), function(instance) { - new Masonry('.grid', { - itemSelector: '.grid-item', - columnWidth: '.grid-sizer', - fitWidth: true, - gutter: 10, - }); -}); +if (window.matchMedia('(max-device-width: 768px)').matches) { + document.getElementById("nav-menu").open = false; +} diff --git a/themes/red/layouts/_default/baseof.html b/themes/red/layouts/_default/baseof.html index d6b0052..315de14 100644 --- a/themes/red/layouts/_default/baseof.html +++ b/themes/red/layouts/_default/baseof.html @@ -13,5 +13,11 @@ + + {{ $site := resources.Get "js/site.js" }} + {{ if hugo.IsProduction }} + {{ $site = $site | minify | fingerprint | resources.PostProcess }} + {{ end }} + diff --git a/themes/red/layouts/_default/gallery.html b/themes/red/layouts/_default/gallery.html index c94cadb..9f3fe7e 100644 --- a/themes/red/layouts/_default/gallery.html +++ b/themes/red/layouts/_default/gallery.html @@ -14,7 +14,7 @@ - {{ $site := resources.Get "js/site.js" }} + {{ $site := resources.Get "js/gallery.js" }} {{ if hugo.IsProduction }} {{ $site = $site | minify | fingerprint | resources.PostProcess }} {{ end }} diff --git a/themes/red/layouts/partials/art-gallery.html b/themes/red/layouts/partials/art-gallery.html index 947d129..c118dd6 100644 --- a/themes/red/layouts/partials/art-gallery.html +++ b/themes/red/layouts/partials/art-gallery.html @@ -26,7 +26,7 @@ -{{ $site := resources.Get "js/site.js" }} +{{ $site := resources.Get "js/gallery.js" }} {{ if hugo.IsProduction }} {{ $site = $site | minify | fingerprint | resources.PostProcess }} {{ end }} diff --git a/themes/red/layouts/partials/art-years.html b/themes/red/layouts/partials/art-years.html index 44872a5..4c9c8e4 100644 --- a/themes/red/layouts/partials/art-years.html +++ b/themes/red/layouts/partials/art-years.html @@ -2,7 +2,7 @@
{{ range $.Param "years" }} {{ $year := . }} - + {{ $thumbp := printf "/year-thumbs/%d.webp" . }} {{ with resources.Get $thumbp }} {{ $year }} diff --git a/themes/red/layouts/partials/featured-art.html b/themes/red/layouts/partials/featured-art.html index 1576b44..68dba66 100644 --- a/themes/red/layouts/partials/featured-art.html +++ b/themes/red/layouts/partials/featured-art.html @@ -18,7 +18,7 @@ {{ $path := printf "/art/%d/%.2d/%s" (int $year) (int $month) $filename_without_ext}} - + {{ $title := .title }} {{ with resources.Get (printf "art/%s" .filename) }} {{ $image := .Resize "500x" }} diff --git a/themes/red/layouts/partials/render-art.html b/themes/red/layouts/partials/render-art.html index e011b54..1e2bffe 100644 --- a/themes/red/layouts/partials/render-art.html +++ b/themes/red/layouts/partials/render-art.html @@ -12,7 +12,7 @@ {{ $year = index $split 3 }} {{ end }} - + {{ $path := printf "/art/%d/%.2d/%s" (int $year) (int $month) $filename_without_ext}} {{ $title := .Params.title }} {{ $image := (resources.Get (printf "art/%s.webp" .Params.slug)).Resize "400x" }} diff --git a/themes/red/layouts/partials/sidebar.html b/themes/red/layouts/partials/sidebar.html index 6c4ceee..6b79d7f 100644 --- a/themes/red/layouts/partials/sidebar.html +++ b/themes/red/layouts/partials/sidebar.html @@ -1,9 +1,12 @@