mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: refactor files
feat: refactor more files feat: uppercase component folder 1/2 feat: uppercase component folder 2/2
This commit is contained in:
parent
a371394670
commit
d361e68dc0
31 changed files with 101 additions and 117 deletions
33
front/components/Modals/CourseEdit/NewChapter.tsx
Normal file
33
front/components/Modals/CourseEdit/NewChapter.tsx
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import React, { useState } from "react";
|
||||
import Modal from "../Modal";
|
||||
|
||||
function NewChapterModal({ submitChapter , closeModal }: any) {
|
||||
const [chapterName, setChapterName] = useState("");
|
||||
const [chapterDescription, setChapterDescription] = useState("");
|
||||
|
||||
const handleChapterNameChange = (e: any) => {
|
||||
setChapterName(e.target.value);
|
||||
};
|
||||
|
||||
const handleChapterDescriptionChange = (e: any) => {
|
||||
setChapterDescription(e.target.value);
|
||||
};
|
||||
|
||||
const handleSubmit = async (e: any) => {
|
||||
e.preventDefault();
|
||||
console.log({ chapterName, chapterDescription });
|
||||
submitChapter({ name : chapterName, description : chapterDescription , elements : [] });
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal>
|
||||
<h1>Add New Chapter <button onClick={closeModal}>X</button></h1>
|
||||
<input type="text" onChange={handleChapterNameChange} placeholder="Chapter Name" /> <br />
|
||||
<input type="text" onChange={handleChapterDescriptionChange} placeholder="Chapter Description" />
|
||||
<br />
|
||||
<button onClick={handleSubmit}>Add Chapter</button>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export default NewChapterModal;
|
||||
Loading…
Add table
Add a link
Reference in a new issue