Skip to content

Commit

Permalink
Fix edit submission
Browse files Browse the repository at this point in the history
  • Loading branch information
sltsheryl committed Jul 24, 2023
1 parent c41f5d2 commit 9bece5d
Showing 1 changed file with 45 additions and 41 deletions.
86 changes: 45 additions & 41 deletions components/student/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -1036,52 +1036,56 @@ const SubmissionForm = ({
return (
<button
className="mt-4 px-2 py-1 bg-green-600 hover:bg-green-700 text-white rounded m-2 focus:outline-none"
onClick={() => setEditing(true)}
onClick={() => {
setEditing(true);
}
}
>
Edit Submission
</button>
);
}
}
} else {
return (
<div className="w-full">
<h2 className="text-xl pl-2 pt-4">Submit</h2>
{!task.is_group ? (
<small className="text-gray-500 pl-2">
Both text and images are accepted.
</small>
) : (
<small className="text-gray-500 pl-2">
Text and links are accepted.
</small>
)}
}
else {
return (
<div className="w-full">
<h2 className="text-xl pl-2 pt-4">Submit</h2>
{!task.is_group ? (
<small className="text-gray-500 pl-2">
Both text and images are accepted.
</small>
) : (
<small className="text-gray-500 pl-2">
Text and links are accepted.
</small>
)}

<form onSubmit={(e) => submitForm(e)}>
<div className="px-2">
<textarea
onChange={(e) => setTextInput(e.target.value)}
className="outline-none border-2 border-gray-100 focus:border-gray-300 px-2 py-2 my-2 rounded-lg w-full"
rows="4"
value={textInput}
name="description"
/>
</div>
{!task.is_group && <div className="flex flex-row-reverse items-center">
<input
type="file"
className="bg-gray-400 text-white px-2 py-1 w-min text-sm rounded-lg"
onChange={(e) => setFileInput(e.target.files[0])}
/>
</div>}
<button
type="submit"
className="mt-4 px-2 py-1 bg-green-600 hover:bg-green-700 text-white rounded focus:outline-none"
>
Submit
</button>
</form>
</div>
);
<form onSubmit={(e) => submitForm(e)}>
<div className="px-2">
<textarea
onChange={(e) => setTextInput(e.target.value)}
className="outline-none border-2 border-gray-100 focus:border-gray-300 px-2 py-2 my-2 rounded-lg w-full"
rows="4"
value={textInput}
name="description"
/>
</div>
{!task.is_group && <div className="flex flex-row-reverse items-center">
<input
type="file"
className="bg-gray-400 text-white px-2 py-1 w-min text-sm rounded-lg"
onChange={(e) => setFileInput(e.target.files[0])}
/>
</div>}
<button
type="submit"
className="mt-4 px-2 py-1 bg-green-600 hover:bg-green-700 text-white rounded focus:outline-none"
>
Submit
</button>
</form>
</div>
);
}
}
};

0 comments on commit 9bece5d

Please sign in to comment.