/** * Detail view, displaying text plus media */ 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 (
{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(" ");