From 271b1e2ce74876536e548cd8e90ddec6c214b1d5 Mon Sep 17 00:00:00 2001 From: Mael Date: Wed, 7 Apr 2021 15:03:55 +0200 Subject: [PATCH] Affichage du recueil d'imaginaires comme un encart et des tags --- code/Articles.js | 14 ++++++++++++-- code/Blog.js | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/code/Articles.js b/code/Articles.js index 008b6f8..27eb3df 100644 --- a/code/Articles.js +++ b/code/Articles.js @@ -54,13 +54,14 @@ const Header = () => ( ) export default ({ year }) => { let year2 = year || useParams().year + let tag = useParams().tag return (
{ ? -1 : 1 ) - .filter((a) => new Date(a.attributes.date).getFullYear() == year2) + .filter((a) => { + const date = a.attributes.date, + goodDate = new Date(date).getFullYear() == year2 + + const tags = a.attributes.tags || [], + goodTag = tags.includes(tag) + + return tag ? goodTag : !tags.includes('imaginaires') && goodDate + }) + .map((a) => (
  • diff --git a/code/Blog.js b/code/Blog.js index fadd4a9..9cd1265 100644 --- a/code/Blog.js +++ b/code/Blog.js @@ -19,6 +19,9 @@ export default ({}) => ( + + +