From 84d56cbeaa41321367f28af039fcefe4c6ee233e Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Tue, 7 Jun 2022 12:30:17 -0700 Subject: [PATCH] initial pass at media page --- components/LayoutWrapper.tsx | 2 +- components/MediaItem.tsx | 24 ++++++++++++++++++++++ components/PhotoGallery.tsx | 21 +++++++++++++++++++ components/ThemeSwitch.tsx | 38 ----------------------------------- components/YouTubeVideo.tsx | 18 +++++++++++++++++ data/mediaData.ts | 9 +++++++++ layouts/PostLayout.tsx | 14 ++----------- package-lock.json | Bin 995318 -> 1039466 bytes package.json | 2 ++ pages/media.tsx | 30 +++++++++++++++++++++++++++ pages/tour.tsx | 2 +- 11 files changed, 108 insertions(+), 52 deletions(-) create mode 100644 components/MediaItem.tsx create mode 100644 components/PhotoGallery.tsx delete mode 100644 components/ThemeSwitch.tsx create mode 100644 components/YouTubeVideo.tsx create mode 100644 data/mediaData.ts create mode 100644 pages/media.tsx diff --git a/components/LayoutWrapper.tsx b/components/LayoutWrapper.tsx index 93f1873..689f74b 100644 --- a/components/LayoutWrapper.tsx +++ b/components/LayoutWrapper.tsx @@ -29,7 +29,7 @@ const LayoutWrapper = ({ children }: Props) => { {link.title} diff --git a/components/MediaItem.tsx b/components/MediaItem.tsx new file mode 100644 index 0000000..bf11620 --- /dev/null +++ b/components/MediaItem.tsx @@ -0,0 +1,24 @@ +import PhotoGallery from './PhotoGallery' +import YoutubeVideo from './YouTubeVideo' + +const MediaItem = (props) => { + const { type, title, data } = props + + if (type !== 'video' && type !== 'photos') return null + + const item = + type === 'video' ? ( + + ) : ( + + ) + + return ( +
+

{title}

+ {item} +
+ ) +} + +export default MediaItem diff --git a/components/PhotoGallery.tsx b/components/PhotoGallery.tsx new file mode 100644 index 0000000..7806575 --- /dev/null +++ b/components/PhotoGallery.tsx @@ -0,0 +1,21 @@ +import 'photoswipe/dist/photoswipe.css' +import { Gallery, Item } from 'react-photoswipe-gallery' +import Image from './Image' + +const PhotoGallery = (props) => { + const { title, data } = props + + return ( + + {data.length + ? data.map((d: string) => ( + + {({ ref, open }) => {title}} + + )) + : null} + + ) +} + +export default PhotoGallery diff --git a/components/ThemeSwitch.tsx b/components/ThemeSwitch.tsx deleted file mode 100644 index 5409766..0000000 --- a/components/ThemeSwitch.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { useEffect, useState } from 'react' -import { useTheme } from 'next-themes' - -const ThemeSwitch = () => { - const [mounted, setMounted] = useState(false) - const { theme, setTheme, resolvedTheme } = useTheme() - - // When mounted on client, now we can show the UI - useEffect(() => setMounted(true), []) - - return ( - - ) -} - -export default ThemeSwitch diff --git a/components/YouTubeVideo.tsx b/components/YouTubeVideo.tsx new file mode 100644 index 0000000..e32e7e9 --- /dev/null +++ b/components/YouTubeVideo.tsx @@ -0,0 +1,18 @@ +const YoutubeVideo = (props) => { + const { title, data } = props + + return ( +
+