From 824e062cfde1a5dbddf3cdc42c517239d1f7a149 Mon Sep 17 00:00:00 2001 From: "max.mehl" Date: Mon, 9 Mar 2020 13:53:41 +0100 Subject: [PATCH] improve dealing with small images --- layouts/shortcodes/figure.html | 90 +++++++++++++++++----------------- static/css/snap-gallery.css | 10 ++++ 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 5db3b38..3621228 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -33,51 +33,53 @@ {{- end -}}
- {{ if (.Get "link") -}} - - {{ else -}} - - {{- end -}} - - {{ . }} - {{- if or (.Get "caption") (.Get "attr")}} -
- {{- .Get "caption" | markdownify -}} - {{- with .Get "attr" }} {{ . | markdownify}}{{ end -}} -
- {{- end }} -
- -
- -
- -

- {{- if or (.Get "caption") (.Get "attr") -}} - {{- .Get "caption" | markdownify -}} - {{- with .Get "attrlink" }} {{- end -}} - {{- with .Get "attr" }} {{ . | markdownify}}{{ end -}} - {{- with .Get "attrlink" }}{{- end -}} +

+ {{ if (.Get "link") -}} + + {{ else -}} + + {{- end -}} + + {{ . }} + {{- if or (.Get "caption") (.Get "attr")}} +
+ {{- .Get "caption" | markdownify -}} + {{- with .Get "attr" }} {{ . | markdownify}}{{ end -}} +
+ {{- end }} +
+ +
+ +
+ +

+ {{- if or (.Get "caption") (.Get "attr") -}} + {{- .Get "caption" | markdownify -}} + {{- with .Get "attrlink" }} {{- end -}} + {{- with .Get "attr" }} {{ . | markdownify}}{{ end -}} + {{- with .Get "attrlink" }}{{- end -}} + {{- end }} +

+
+ + {{- if .Parent -}} + {{- if not (eq $figid 1) -}} + + {{- else -}} + + {{- end -}} + + {{- end }} -

- - {{- if .Parent -}} - {{- if not (eq $figid 1) -}} - - {{- else -}} - - {{- end -}} - - - {{- end }}
diff --git a/static/css/snap-gallery.css b/static/css/snap-gallery.css index 75ffbd1..e3a0946 100644 --- a/static/css/snap-gallery.css +++ b/static/css/snap-gallery.css @@ -10,7 +10,12 @@ figure { margin: 30px auto 40px; display: block; text-align: center; +} + +/* make box with box-shadow only as large as image */ +.snap-wrapper { box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19); + display: inline-block; } figure a:hover { @@ -59,6 +64,11 @@ figure figcaption { flex-wrap: wrap; } +/* avoid sick effects of inline-block on gallery elements */ +.snap-gallery .snap-wrapper { + display: block; +} + .snap-gallery figure { position: relative; width: 30%;