From 7a4171d021a709e0af1e0e13830514c67ec97702 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 3 Aug 2024 22:18:31 +0900 Subject: feat: partially implement submit action --- .../components/GolfPlayApps/GolfPlayAppGaming.tsx | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'frontend/app/components/GolfPlayApps') diff --git a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx index 75ab18e..9fddb01 100644 --- a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx +++ b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx @@ -1,18 +1,30 @@ +import React, { useRef } from "react"; + type Props = { problem: string; onCodeChange: (code: string) => void; + onCodeSubmit: (code: string) => void; currentScore: number | null; }; export default function GolfPlayAppGaming({ problem, onCodeChange, + onCodeSubmit, currentScore, }: Props) { + const textareaRef = useRef(null); + const handleTextChange = (e: React.ChangeEvent) => { onCodeChange(e.target.value); }; + const handleSubmitButtonClick = () => { + if (textareaRef.current) { + onCodeSubmit(textareaRef.current.value); + } + }; + return (
@@ -22,16 +34,25 @@ export default function GolfPlayAppGaming({
{problem}
-
- Score: {currentScore == null ? "-" : `${currentScore}`} +
+
+ Score: {currentScore == null ? "-" : `${currentScore}`} +
+
-- cgit v1.2.3-70-g09d2