diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index f128b62..3f9df6a 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -5,7 +5,7 @@ const StyledHeader = styled.header` margin: 2em auto 1em; @media (min-width: 500px) { - text-align: right; + text-align: center; } ` @@ -25,11 +25,11 @@ const StyledH1 = styled.h1` } ` -export const Header = () => ( +export const Header: React.FC = ({ children }) => ( - Abstract Puzzles + {children} diff --git a/src/components/PageWrapper.tsx b/src/components/PageWrapper.tsx index fe56eef..8da3ee9 100644 --- a/src/components/PageWrapper.tsx +++ b/src/components/PageWrapper.tsx @@ -14,10 +14,12 @@ const StyledWrapper = styled.div` interface Props { accentColorRgb?: string + title?: string } export const PageWrapper: React.FC = ({ accentColorRgb, + title, children, }) => { let faviconUrl = '/api/favicon.svg' @@ -30,7 +32,9 @@ export const PageWrapper: React.FC = ({ } > -
+
+ {title || 'Abstract Puzzles'} +
{children} diff --git a/src/components/SketchCard/index.tsx b/src/components/SketchCard/index.tsx index c66a126..20602b9 100644 --- a/src/components/SketchCard/index.tsx +++ b/src/components/SketchCard/index.tsx @@ -26,10 +26,12 @@ export const SketchCard = ({ }: SketchContent) => ( - {id} + {/* {id} */} diff --git a/src/components/SketchPage/index.tsx b/src/components/SketchPage/index.tsx index ca3346d..a396b8a 100644 --- a/src/components/SketchPage/index.tsx +++ b/src/components/SketchPage/index.tsx @@ -1,10 +1,13 @@ +import React from 'react' import styled, { css } from 'styled-components' import Link from 'next/link' import { SketchContent } from 'types' +import { makeRandomSeedArray } from 'lib/seeds' import { CloudinaryImage } from 'components/CloudinaryImage' import { SketchCard } from 'components/SketchCard' import { Button } from 'components/Button' +import RefreshButton from 'components/AppSidebar/Controls/RefreshButton' import { Player } from './Player' import ReactMarkdown from 'react-markdown' @@ -14,13 +17,13 @@ const BP_DESKTOP = '900px' const StyledGrid = styled.article` display: grid; - grid-template-columns: 2fr 2fr 2fr 3fr; - grid-template-rows: auto auto auto 1fr; - grid-template-areas: 'title title video video' 'image image video video' 'image image details details' 'empty actions details details'; + grid-template-columns: 1fr 2fr; + grid-template-rows: auto 1fr; + grid-template-areas: 'video video' 'image details'; grid-gap: 2em; margin: 3em 0; - @media (max-width: ${BP_DESKTOP}) { + /* @media (max-width: ${BP_DESKTOP}) { grid-template-columns: 1fr 2fr; grid-template-rows: auto 1fr; grid-template-areas: 'title image' 'actions image' 'empty details'; @@ -32,6 +35,14 @@ const StyledGrid = styled.article` grid-template-columns: 1fr; grid-template-rows: 1fr auto auto; grid-template-areas: 'title' 'image' 'actions' 'details' 'previews'; + } */ + + @media (max-width: ${BP_MOBILE}) { + margin: 2em 0; + grid-gap: 1.5em; + grid-template-columns: 1fr; + grid-template-rows: 1fr auto auto; + grid-template-areas: 'image' 'details'; } > * > *:first-child { @@ -75,14 +86,20 @@ const StyledVideo = styled.figure` } ` +const StyledImageWrapper = styled.div` + grid-area: image; +` + const StyledImage = styled.figure` + position: sticky; + top: 2em; + bottom: 0; margin: 0; - grid-area: image; - position: relative; width: 100%; height: 0; padding-bottom: 100%; background: #000; + text-align: center; ` const StyledDetails = styled.div` @@ -134,10 +151,10 @@ const StyledButton = styled(Button)<{ ` const StyledPreviews = styled.aside` - display: grid; - grid-gap: 1em; - grid-template-columns: repeat(2, 1fr); - margin: 2em 0 0; + grid-area: previews; + /* display: grid; + grid-gap: 2em; + grid-template-columns: 1fr 1fr; */ ` const StyledLink = styled.a<{ $internal: boolean }>` @@ -178,21 +195,69 @@ export const SketchPage = ({ imagePath, markdownDescription, previewSketches, + pieces, + datePublished, }: Props) => ( - {id} + {/* {id} */} - - - - + + + +

+ Posted{' '} + {new Date(datePublished).toLocaleString('en-GB', { + dateStyle: 'medium', + })} +

+

+ Solved 1h 43mins +

+

{pieces} pieces

+

+ + + {' '} + Previous puzzle +

+

+ + + {' '} + Next puzzle +

+
+
+ {/* Open in explorer @@ -205,7 +270,7 @@ export const SketchPage = ({ Watch solve - + */} - - {previewSketches.map((sketch) => ( - +

Explore designs

+

+ + These designs have been generated on the fly from the code for this + jigsaw: + +

+ +
+ {[...Array(3)].map((_, i) => ( +
+ +
+ {makeRandomSeedArray(4).join('_')} + +
+
))} - +
+ +

+ You can play with the parameters of this programme in{' '} + + the explorer + {' '} + or check the code out{' '} + + on GitHub + + . +

+ + {/* + {previewSketches.map((sketch, i) => ( +
+ Go to {i === 0 ? 'next' : 'previous'} sketch - {sketch.id} + +
+ ))} +
*/}
) diff --git a/src/pages/[sketch].tsx b/src/pages/[sketch].tsx index 6a65f62..f08b2dc 100644 --- a/src/pages/[sketch].tsx +++ b/src/pages/[sketch].tsx @@ -30,7 +30,7 @@ const SketchPage = ({ sketch, previewSketches }: Props) => { useSetLocalStorageSeeds(sketch) return ( - +