From 3e15e4d50229a180f54031c430ff9b42695f4440 Mon Sep 17 00:00:00 2001 From: Wren Hawthorne Date: Sun, 14 Jul 2024 23:40:58 -0700 Subject: [PATCH] Share improvement --- src/components/ShareStep.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/ShareStep.tsx b/src/components/ShareStep.tsx index 7a5a30c..a8e764f 100644 --- a/src/components/ShareStep.tsx +++ b/src/components/ShareStep.tsx @@ -3,7 +3,7 @@ import SlIcon from "@shoelace-style/shoelace/dist/react/icon/index.js" import { WorkflowDispatchContext } from "./WorkflowContext"; -import { useContext } from "react"; +import { useContext, useState } from "react"; import { WorkflowStep } from "../utils/workflow"; import { PlayButton } from "./PlayButton"; @@ -14,6 +14,7 @@ type ShareStepProps = { export const ShareStep = (props: ShareStepProps) => { const { title, shareUrl } = props + const [shared, setShared] = useState(false) const dispatch = useContext(WorkflowDispatchContext) return ( @@ -62,8 +63,11 @@ export const ShareStep = (props: ShareStepProps) => { } else { navigator.clipboard.writeText(shareUrl) } + navigator.clipboard.writeText(shareUrl) + setShared(true) }}> - Share + + {shared ? "Copied to Clipboard" : "Share"}