From 507c972ecafeceaf4f8962ad881f8fb50c9b86c1 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sat, 4 Oct 2025 17:37:22 -0700 Subject: paste art --- src/pages/ChooseArt.tsx | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/pages/Paint.tsx | 11 +++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/pages/ChooseArt.tsx create mode 100644 src/pages/Paint.tsx (limited to 'src/pages') diff --git a/src/pages/ChooseArt.tsx b/src/pages/ChooseArt.tsx new file mode 100644 index 0000000..fab6d79 --- /dev/null +++ b/src/pages/ChooseArt.tsx @@ -0,0 +1,45 @@ +import type React from 'react'; +import { useEffect, useRef, useState } from 'react'; + +export interface ChooseArtProps { + artSubmissionCallback: (art: string) => void; +} + +export const ChooseArt: React.FC = ({ + artSubmissionCallback, +}) => { + const [art, setArt] = useState(''); + const promptRef = useRef(null); + + useEffect(() => { + if (!promptRef.current) { + return; + } + // Automatically focus the textarea when the component mounts + promptRef.current.focus(); + }, [promptRef]); + + const handleSubmit = () => { + if (!art.trim()) { + return; + } + artSubmissionCallback(art); + }; + + return ( +
+