: 여기서는 강의의 커리큘럼을 먼저 구성할 수 있다.
이렇게 만들어진 커리큘럼 내부에 다음 페이지에서 세부 강의를 등록하는 방식이다.
플러스 버튼을 눌러서 챕터의 갯수를 늘릴 수 있고 강의도 추가로 늘릴 수 있다.
const [curriculum, setCurriculum] = useState([{}]);
{}
객체를 한개 넣어두었다. const addChapterBox = () => {
const getCurriculum = [...curriculum];
setCurriculum(getCurriculum.concat({}));
};
: Lacture.js 의 자식 컴포넌트로 input을 위한 Form의 구조가 짜여져 있다.
const onChangeImage = (e) => {
e.preventDefault();
let file = e.target.files[0];
setUploadImage([...uploadImage, file]);
};
const onChangeViewerImage = (e) => {
let reader = new FileReader();
if (e.target.files[0]) {
reader.readAsDataURL(e.target.files[0]);
reader.onloadend = () => {
const imageUrl = reader.result;
setImageViewer(imageUrl.toString());
};
}
};
const [LectureList, setLectureTitleList] = useState([{ name: '' }]);
const onChangeLectureIitleList = (e, lectureIndex) => {
const getLectureList = [...LectureList];
getLectureList[lectureIndex].name = e.target.value;
setLectureTitleList(getLectureList);
};
const upLoadLectureVideo = (e) => {
e.preventDefault();
let reader = new FileReader();
if (e.target.files[0]) {
reader.readAsDataURL(e.target.files[0]);
}
reader.onloadend = () => {
const rawImagePath = reader.result;
const imagePath = rawImagePath.toString();
setVideoViewer(imagePath);
};
};