-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4443b39
commit 2cf56f7
Showing
7 changed files
with
396 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,63 @@ | ||
|
||
import { ICard } from "@/lib/api"; | ||
import { faComment } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { useState } from "react"; | ||
|
||
interface CommentBoxProps { | ||
scores: Record<string, number> | ||
scores: Record<string, number>; | ||
card: ICard; | ||
onSubmit: (data: { | ||
comment: string; | ||
card: ICard; | ||
onSubmit: (data: { comment: string, card: ICard, scores: Record<string, number> }) => void; | ||
onReset: () => void; | ||
scores: Record<string, number>; | ||
index: number; | ||
}) => void; | ||
onReset: () => void; | ||
index: number; | ||
} | ||
|
||
export default function CommentBox({ onSubmit, card, scores, onReset }: CommentBoxProps) { | ||
const [comment, setComment] = useState<string>(""); | ||
// const [scores, setRubricScores] = useState<Record<string, number>>({}); | ||
|
||
const handleSubmit = () => { | ||
onSubmit({ comment, card, scores}); | ||
setComment(""); | ||
onReset(); // Reset the scores after submission | ||
}; | ||
export default function CommentBox({ | ||
onSubmit, | ||
card, | ||
scores, | ||
onReset, | ||
index, | ||
}: CommentBoxProps) { | ||
const [comment, setComment] = useState<string>(""); | ||
// const [scores, setRubricScores] = useState<Record<string, number>>({}); | ||
|
||
const handleSubmit = () => { | ||
onSubmit({ comment, card, scores, index }); | ||
setComment(""); | ||
onReset(); // Reset the scores after submission | ||
}; | ||
|
||
return ( | ||
|
||
<div className="my-12"> | ||
<div className="relative block"> | ||
return ( | ||
<div className="my-12"> | ||
<div className="relative block"> | ||
<label htmlFor="comment" className="mb-2 mt-4 block"> | ||
<FontAwesomeIcon | ||
<FontAwesomeIcon | ||
className="left-2 top-1/2 ml-2 h-[20px] w-[28px] cursor-pointer object-contain" | ||
icon={faComment} | ||
/> | ||
Comments: | ||
/> | ||
Comments: | ||
</label> | ||
<textarea | ||
id="comment" | ||
className="h-32 w-full rounded border p-2" | ||
value={comment} | ||
onChange={(e) => setComment(e.target.value)} | ||
placeholder="Add feedback here" | ||
id="comment" | ||
className="h-32 w-full rounded border p-2" | ||
value={comment} | ||
onChange={(e) => setComment(e.target.value)} | ||
placeholder="Add feedback here" | ||
></textarea> | ||
</div> | ||
<div className="flex justify-center mt-4"> | ||
<button | ||
onClick={handleSubmit} | ||
className="bg-blue-500 rounded bg-secondary px-4 py-2 text-white" | ||
> | ||
Submit | ||
</button> | ||
</div> | ||
</div> | ||
<div className="mt-4 flex justify-center"> | ||
<button | ||
onClick={handleSubmit} | ||
className="bg-blue-500 w-full rounded bg-secondary px-4 py-2 text-lg text-white" | ||
> | ||
Submit | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.