From 6bc5fded116b4b2c548baa2c1da70dfaa7eafc6a Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Thu, 29 Sep 2022 17:24:11 +0200 Subject: [PATCH] feat(gallery): add historical date parsing feat: add logo file --- assets/sass/footer.scss | 4 ++ assets/sass/gallery.scss | 20 +++++++++- assets/sass/main.scss | 3 +- assets/sass/single_image.scss | 18 +++++++++ content/images/3/index.md | 1 + layouts/images/single.html | 44 ++++++++++++++++++---- layouts/partials/FormatHistoricalDate.html | 36 ++++++++++++++++++ layouts/partials/images-list.html | 15 ++++---- static/etoile_de_bethleem.svg | 1 + 9 files changed, 124 insertions(+), 18 deletions(-) create mode 100644 assets/sass/footer.scss create mode 100644 layouts/partials/FormatHistoricalDate.html create mode 100644 static/etoile_de_bethleem.svg diff --git a/assets/sass/footer.scss b/assets/sass/footer.scss new file mode 100644 index 0000000..ccb2fb8 --- /dev/null +++ b/assets/sass/footer.scss @@ -0,0 +1,4 @@ +footer { + margin-top: 1rem; + background-color: blue; +} diff --git a/assets/sass/gallery.scss b/assets/sass/gallery.scss index f98fd7b..ee697ea 100644 --- a/assets/sass/gallery.scss +++ b/assets/sass/gallery.scss @@ -17,7 +17,7 @@ .gallery__items { display: grid; - grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); + grid-template-columns: repeat(4, minmax(13rem, 1fr)); grid-gap: 1rem; } @@ -41,8 +41,24 @@ justify-content: space-between; } +@media (max-width: $lg-breakpoint) { + // .gallery__items { + // grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)) + // } +} + @media (max-width: $md-breakpoint) { .gallery { - display: block; + display: block; + } + .gallery__items { + grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); } } + +@media (max-width: $xs-breakpoint) { + .gallery__items { + grid-template-columns: 1fr; + } +} + diff --git a/assets/sass/main.scss b/assets/sass/main.scss index fed5b3c..c9d18c9 100644 --- a/assets/sass/main.scss +++ b/assets/sass/main.scss @@ -1,4 +1,4 @@ -$lg-breakpoint: 1500px; +$lg-breakpoint: 1600px; $md-breakpoint: 1100px; $sm-breakpoint: 900px; $xs-breakpoint: 400px; @@ -17,4 +17,5 @@ $secondary: red; @import 'header.scss'; @import 'gallery.scss'; @import 'single_image.scss'; +@import 'footer.scss'; diff --git a/assets/sass/single_image.scss b/assets/sass/single_image.scss index 5730a58..edfd6a9 100644 --- a/assets/sass/single_image.scss +++ b/assets/sass/single_image.scss @@ -26,6 +26,8 @@ .single-image__property { display: flex; align-items: center; + margin-bottom: .2rem; + min-height: 2rem; div:first-of-type { margin-right: 1rem; } @@ -41,6 +43,7 @@ margin: 0; list-style-type: none; display: flex; + align-items: center; padding: 0; li { border: 1px solid black; @@ -68,3 +71,18 @@ } } + +@media (max-width: $sm-breakpoint) { + .single-image { + .single-image__property { + display: block; + } + } + +} + + + + + + diff --git a/content/images/3/index.md b/content/images/3/index.md index a62059b..0ccc312 100644 --- a/content/images/3/index.md +++ b/content/images/3/index.md @@ -5,5 +5,6 @@ mime_type: image/jpeg imtags: - crypte - etoile +#inception: 2000-10-08 --- diff --git a/layouts/images/single.html b/layouts/images/single.html index 8ddc6da..fec4490 100644 --- a/layouts/images/single.html +++ b/layouts/images/single.html @@ -6,20 +6,48 @@

{{ .Title }}

Étiquettes associées à l'image :
- - - - - -
-
Nom original :
{{ .Params.original_name }}
+
Nom original :
+
{{ .Params.original_name }}
+
+
+ + {{ with .Params.inception }} + {{/* + {{ $dateType := "exact" }} + {{ $date := "" }} + {{ $dateFrom := "" }} + {{ $dateTo := "" }} + {{ $datePrecision := "" }} + {{ if reflect.IsMap . }} + {{ $dateType = "range" }} + {{ $dateFrom = .from }} + {{ $dateTo = .to }} + {{ else }} + {{ $date = . }} + {{ end }} + {{ if eq $dateType "range" }} + Document daté entre le {{ .from }} et {{ .to }} + {{ else }} + {{ partial "FormatHistoricalDate.html" . }} + {{ end }} + */}} + Date du document : {{ partial "FormatHistoricalDate.html" . }} + {{ else }} + Pas encore de de date ajouté + {{ end }}
{{ .Content }} diff --git a/layouts/partials/FormatHistoricalDate.html b/layouts/partials/FormatHistoricalDate.html new file mode 100644 index 0000000..bcdf487 --- /dev/null +++ b/layouts/partials/FormatHistoricalDate.html @@ -0,0 +1,36 @@ +{{ $formattedDate := "" }} +{{ $rawDate := . }} +{{- $date := "1800-01-01" -}} +{{- $datePrecision := "day" -}} + +{{ if reflect.IsMap $rawDate }} + {{ partial "FormatHistoricalDate" ($rawDate.from) }} + - + {{ partial "FormatHistoricalDate" ($rawDate.to) }} +{{ else }} + {{ $rawDate = string $rawDate }} + {{ if eq (len $rawDate) 4 }} + {{ $datePrecision = "year" }} + {{ $date = printf "%s-01-01" $rawDate }} + {{ end }} + {{ if eq (len $rawDate) 7 }} + {{ $datePrecision = "month" }} + {{ $date = printf "%s-01" $rawDate }} + {{ end }} + {{ if eq (len $rawDate) 10 }} + {{ $datePrecision = "day" }} + {{ $date = $rawDate }} + {{ end }} + + {{- if eq $datePrecision "year" -}} + {{ $formattedDate = ($date | time.Format "2006") }} + {{- end -}} + {{- if eq $datePrecision "month" -}} + {{ $formattedDate = ($date | time.Format "January 2006") }} + {{- end -}} + {{- if eq $datePrecision "day" -}} + {{ $formattedDate = ($date | time.Format "2 January 2006") }} + {{- end -}} +{{ end }} + +{{ printf "%s" $formattedDate }} diff --git a/layouts/partials/images-list.html b/layouts/partials/images-list.html index 0f6a5ad..3931503 100644 --- a/layouts/partials/images-list.html +++ b/layouts/partials/images-list.html @@ -12,29 +12,30 @@