From 1cc630da4247e75a18629d960768d06239b0175b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 24 Aug 2021 18:40:19 +0200 Subject: details and gallery --- src/views/Detail.js | 65 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 19 deletions(-) (limited to 'src/views/Detail.js') diff --git a/src/views/Detail.js b/src/views/Detail.js index 51598c1..0a756c9 100644 --- a/src/views/Detail.js +++ b/src/views/Detail.js @@ -2,30 +2,57 @@ * Detail view, displaying text plus media */ -export default function Detail({ node }) { - const index = id + 1; +import React from "react"; + +import Gallery from "./Gallery.js"; + +export default function Detail({ node, visible, onClose }) { + if (!node) { + return
; + } + const { id, data } = node; + const index = id + 1; return ( -
+
-
- {index} -
- {data.author} -
- {data.title} -
+
+
+
{pad(index)}
+ {data.author && ( +
+ )} +
+
+
+
+
+
+
+
+
-
-
+ {node.type === "video" ? ( + "video" + ) : ( + + )}
-
); } + +const pad = (value) => (value < 10 ? "0" + value : value); +const capitalizeWord = (text = "") => + text ? text.charAt(0).toUpperCase() + text.slice(1) : ""; +const capitalize = (text = "") => + String(text || "") + .split(" ") + .map(capitalizeWord) + .join(" "); -- cgit v1.2.3-70-g09d2