From 1761d75ddc09b589d441a05591b2a5ee449d3915 Mon Sep 17 00:00:00 2001 From: Maciej Jur Date: Tue, 23 Jul 2024 20:15:15 +0200 Subject: [PATCH] fix map styles --- Cargo.lock | 2 +- src/html/mod.rs | 51 +++++++++++-------- .../photos/MarkerCluster-Default.css | 0 .../css => styles/photos}/MarkerCluster.css | 0 .../static/css => styles/photos}/leaflet.css | 0 styles/photos/leaflet.scss | 31 +++++++++++ .../static/css => styles/reveal}/reveal.css | 0 styles/reveal/reveal.scss | 1 + 8 files changed, 63 insertions(+), 22 deletions(-) rename public/static/css/MarkerCluster.Default.css => styles/photos/MarkerCluster-Default.css (100%) rename {public/static/css => styles/photos}/MarkerCluster.css (100%) rename {public/static/css => styles/photos}/leaflet.css (100%) create mode 100644 styles/photos/leaflet.scss rename {public/static/css => styles/reveal}/reveal.css (100%) create mode 100644 styles/reveal/reveal.scss diff --git a/Cargo.lock b/Cargo.lock index 426d988..b1f71c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -725,7 +725,7 @@ dependencies = [ [[package]] name = "hauchiwa" -version = "0.0.2" +version = "0.0.3" dependencies = [ "camino", "chrono", diff --git a/src/html/mod.rs b/src/html/mod.rs index 6a97297..1bb23d6 100644 --- a/src/html/mod.rs +++ b/src/html/mod.rs @@ -43,10 +43,8 @@ where // link rel="sitemap" href="/sitemap.xml"; link rel="stylesheet" href="/styles.css"; - link rel="stylesheet" href="/static/css/reveal.css"; - link rel="stylesheet" href="/static/css/leaflet.css"; - link rel="stylesheet" href="/static/css/MarkerCluster.css"; - link rel="stylesheet" href="/static/css/MarkerCluster.Default.css"; + link rel="stylesheet" href="/reveal.css"; + link rel="stylesheet" href="/leaflet.css"; link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"; link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"; link rel="icon" href="/favicon.ico" sizes="any"; @@ -165,6 +163,24 @@ where ) } + +fn full<'s, 'p, 'html>( + sack: &'s Sack, + main: impl Renderable + 'p, + title: String, +) -> impl Renderable + 'html +where + 's: 'html, + 'p: 'html, +{ + let main = maud_move!( + (navbar()) + (main) + ); + + bare(sack, main, title) +} + fn page<'s, 'p, 'html>( sack: &'s Sack, main: impl Renderable + 'p, @@ -174,18 +190,13 @@ where 's: 'html, 'p: 'html, { - maud_move!( - (Raw("")) - html lang="en" { - (head(sack, title)) + let main = maud_move!( + (navbar()) + (main) + (footer(sack)) + ); - body { - (navbar()) - (main) - (footer(sack)) - } - } - ) + bare(sack, main, title) } pub(crate) fn to_list(sack: &Sack, list: Vec, title: String) -> String { @@ -212,15 +223,13 @@ pub(crate) fn map<'s, 'html>(sack: &'s Sack) -> impl Renderable + 'html where 's: 'html, { - page( + full( sack, maud!( - main { - div #map style="height: 100%; width: 100%" {} + div #map style="height: 100%; width: 100%" {} - script type="module" { - (Raw("import 'photos';")) - } + script type="module" { + (Raw("import 'photos';")) } ), String::from("Map"), diff --git a/public/static/css/MarkerCluster.Default.css b/styles/photos/MarkerCluster-Default.css similarity index 100% rename from public/static/css/MarkerCluster.Default.css rename to styles/photos/MarkerCluster-Default.css diff --git a/public/static/css/MarkerCluster.css b/styles/photos/MarkerCluster.css similarity index 100% rename from public/static/css/MarkerCluster.css rename to styles/photos/MarkerCluster.css diff --git a/public/static/css/leaflet.css b/styles/photos/leaflet.css similarity index 100% rename from public/static/css/leaflet.css rename to styles/photos/leaflet.css diff --git a/styles/photos/leaflet.scss b/styles/photos/leaflet.scss new file mode 100644 index 0000000..589e34b --- /dev/null +++ b/styles/photos/leaflet.scss @@ -0,0 +1,31 @@ +@use 'leaflet.css'; +@use 'MarkerCluster.css'; +@use 'MarkerCluster-Default.css'; + +.leaflet-marker-photo { + border: 2px solid #fff; + box-shadow: 3px 3px 10px #888; + + div { + width: 100%; + height: 100%; + background-size: cover; + background-position: center center; + background-repeat: no-repeat; + } + + b { + position: absolute; + top: -7px; + right: -11px; + color: #555; + background-color: #fff; + border-radius: 8px; + height: 12px; + min-width: 12px; + line-height: 12px; + text-align: center; + padding: 3px; + box-shadow: 0 3px 14px rgba(0,0,0,0.4); + } +} diff --git a/public/static/css/reveal.css b/styles/reveal/reveal.css similarity index 100% rename from public/static/css/reveal.css rename to styles/reveal/reveal.css diff --git a/styles/reveal/reveal.scss b/styles/reveal/reveal.scss new file mode 100644 index 0000000..01d34dd --- /dev/null +++ b/styles/reveal/reveal.scss @@ -0,0 +1 @@ +@use 'reveal.css';