From fcb3ecbb1486a99be1cc71708c9016403997bb88 Mon Sep 17 00:00:00 2001 From: MarconLP <13001502+MarconLP@users.noreply.github.com> Date: Thu, 13 Apr 2023 23:10:31 +0200 Subject: [PATCH] add sharing modal --- src/components/ModernSwitch.tsx | 25 +++++++++ src/components/ShareModal.tsx | 98 +++++++++++++++++++++++++++++++++ src/pages/share/[videoId].tsx | 7 +-- 3 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 src/components/ModernSwitch.tsx create mode 100644 src/components/ShareModal.tsx diff --git a/src/components/ModernSwitch.tsx b/src/components/ModernSwitch.tsx new file mode 100644 index 0000000..2d802b0 --- /dev/null +++ b/src/components/ModernSwitch.tsx @@ -0,0 +1,25 @@ +import { Switch } from "@headlessui/react"; + +interface Props { + enabled: boolean; + toggle: () => void; +} + +export function ModernSwitch({ enabled, toggle }: Props) { + return ( + + + ); +} diff --git a/src/components/ShareModal.tsx b/src/components/ShareModal.tsx new file mode 100644 index 0000000..34cebca --- /dev/null +++ b/src/components/ShareModal.tsx @@ -0,0 +1,98 @@ +import { Dialog, Switch, Transition } from "@headlessui/react"; +import { Fragment, useState } from "react"; +import { ModernSwitch } from "~/components/ModernSwitch"; + +export function ShareModal() { + const [open, setOpen] = useState(false); + + const [sharing, setSharing] = useState(false); + const [es, sses] = useState(false); + const [as, ssgs] = useState(false); + + const [s, ss] = useState(false); + + return ( + <> + setOpen(true)} + className="cursor-pointer rounded border border-[#0000001a] px-2 py-2 text-sm text-[#292d34] hover:bg-[#fafbfc]" + > + Share + + + + setOpen(false)} + > + +
+ + +
+
+ + +
+ + Share this recording + +
+ + Share link with anyone + + +
+ +
+
+ Expire link + + +
+
+ Delete video when expired + +
+
+ Share link with search engines + +
+
+ Embed code + +
+
+
+
+
+
+
+
+
+ + ); +} diff --git a/src/pages/share/[videoId].tsx b/src/pages/share/[videoId].tsx index 1e6b4d2..530cf6b 100644 --- a/src/pages/share/[videoId].tsx +++ b/src/pages/share/[videoId].tsx @@ -7,6 +7,7 @@ import { useRouter } from "next/router"; import Link from "next/link"; import Image from "next/image"; import { getTime } from "~/utils/getTime"; +import { ShareModal } from "~/components/ShareModal"; const VideoList: NextPage = () => { const router = useRouter(); @@ -49,13 +50,11 @@ const VideoList: NextPage = () => { Personal Library - - Share - +
-
+
{video?.video?.video_url && (