From 99722d5857e318e863b3899c7551dbdceac7d9e2 Mon Sep 17 00:00:00 2001 From: Simon C Date: Tue, 2 Apr 2024 23:18:38 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Modification=20des=20images=20dans=20le?= =?UTF-8?q?s=20actualit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/styles/header.sass | 18 ++++++++++++++++++ assets/styles/main.sass | 8 +++++++- layouts/actualites/single.html | 12 ++++++++++++ layouts/partials/header.html | 9 ++++++--- 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/assets/styles/header.sass b/assets/styles/header.sass index 9a508d8..7da6fea 100644 --- a/assets/styles/header.sass +++ b/assets/styles/header.sass @@ -3,6 +3,21 @@ .header height: 40vh position: relative + z-index: 0 + + &.actu + background-color: var(--color-green) + height: calc(106px + 4rem + 2rem) + .nav + top: 2rem + + @media screen and (max-width: $size-md) + height: calc(86px + 4rem + 2rem) + + @media screen and (max-width: $size-sm) + height: calc(86px + 3rem + 2rem) + .nav + top: 1.5rem &.home height: 60vh @@ -73,6 +88,9 @@ margin: 0 height: $nav-height + li + padding-bottom: 0 + .viemunicipale, .viemunicipale a color: var(--color-green) font-weight: bold diff --git a/assets/styles/main.sass b/assets/styles/main.sass index 744fc1d..c8ff35a 100644 --- a/assets/styles/main.sass +++ b/assets/styles/main.sass @@ -93,7 +93,7 @@ li margin: 0 padding: 1rem @media screen and (max-width: $size-xs) - padding: 1rem .5rem + padding: .5rem .containerGrid display: flex @@ -162,6 +162,12 @@ li a color: white +.actu + #content + margin-top: -4rem + @media screen and (max-width: $size-md) + .container + + .nouveautes border: 1px solid black padding: 20px diff --git a/layouts/actualites/single.html b/layouts/actualites/single.html index 16afa65..749a337 100644 --- a/layouts/actualites/single.html +++ b/layouts/actualites/single.html @@ -1,5 +1,17 @@ {{ define "main" }}
+ {{ $headless := site.GetPage "/" }} + {{ $imageSize := "1208x459 Center webp" }} + {{ $image := default ($headless.Resources.GetMatch "**.jpg") (.Resources.GetMatch (default "**.jpg" .Params.image)) }} + {{ if $image }} + {{ $resized := $image.Fill $imageSize }} + {{ or .Params.image_ .Params.image_credit }} + {{ end }}

{{ .RenderString .Title }}

diff --git a/layouts/partials/header.html b/layouts/partials/header.html index f8d2a03..5748210 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,8 +1,10 @@ {{ $isBig := (default .IsHome .Params.big) }} -{{ $imageSizeSmall := cond $isBig "600x600 Top webp" "600x400 Center webp" }} -{{ $imageSizeBig := cond $isBig "1920x850 Top webp" "1920x450 Center webp" }} -
+{{ $isActualites := eq .Page.CurrentSection.Path "/actualites" }} +
+ {{ if not $isActualites }} {{ $headless := .Site.GetPage "/" }} + {{ $imageSizeSmall := cond $isBig "600x600 Top webp" "600x400 Center webp" }} + {{ $imageSizeBig := cond $isBig "1920x850 Top webp" "1920x450 Center webp" }} {{ $image := default ($headless.Resources.GetMatch "**.jpg") (.Resources.GetMatch (default "**.jpg" .Params.image)) }} {{ if $image }} {{ $resizedSmall := $image.Fill $imageSizeSmall }} @@ -16,6 +18,7 @@ title="{{ or .Params.image_ .Params.image_credit }}" /> {{ end }} + {{ end }}