diff --git a/src/pages/Questions/QuestionPageCard.tsx b/src/pages/Questions/QuestionPageCard.tsx index 4ea15ba0..a1820e6a 100644 --- a/src/pages/Questions/QuestionPageCard.tsx +++ b/src/pages/Questions/QuestionPageCard.tsx @@ -10,10 +10,8 @@ import React, {useState} from "react"; import DeleteIcon from "@icons/questionsPage/deleteIcon"; import {useParams} from "react-router-dom"; import {questionStore} from "@root/questions"; -import CustomCheckbox from "@ui_kit/CustomCheckbox"; import CopyIcon from "@icons/questionsPage/CopyIcon"; import CrossedEyeIcon from "@icons/CrossedEyeIcon"; -import EyeIcon from "@icons/EyeIcon"; import HideIcon from "@icons/questionsPage/hideIcon"; interface Props { @@ -22,13 +20,32 @@ interface Props { } export default function QuestionsPageCard({totalIndex, DeleteClick}: Props) { + + function onDragStart(event: any) { + event + .dataTransfer + .setData('text', event.target.id); + } + + const theme = useTheme(); const params = Number(useParams().quizId); const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore() const [isExpanded, setIsExpanded] = useState(false); const switchState = listQuestions[params][totalIndex].type return ( - + diff --git a/src/pages/Questions/QuestionsPage.tsx b/src/pages/Questions/QuestionsPage.tsx index b905711f..19836cc7 100755 --- a/src/pages/Questions/QuestionsPage.tsx +++ b/src/pages/Questions/QuestionsPage.tsx @@ -23,12 +23,25 @@ export default function QuestionsPage() { let result = listQuizes[params].step - 1 updateQuizesList(params, {step: result ? result : 1}) }; - // const [switchState, setSwitchState] = React.useState(''); - // const SSHC = (data: string) => { - // setSwitchState(data) - // } - const theme = useTheme(); + function onDragOver(event: any) { + event.preventDefault(); + } + + function onDrop(event: any) { + const id = event + .dataTransfer + .getData('text'); + const draggableElement = document.getElementById(id); + const dropzone = event.target; + dropzone.appendChild(draggableElement); + event + .dataTransfer + .clearData(); + } + + + const theme = useTheme(); return ( <> {/**/} @@ -41,13 +54,15 @@ export default function QuestionsPage() { textDecorationColor: theme.palette.brightPurple.main }}>Свернуть всё - - {Object.values(listQuestions[params]).map((e, index) => ( - removeQuestion(params,index)}/> - ) - )} - - + + {Object.values(listQuestions[params]).map((e, index) => ( + removeQuestion(params,index)}/> + ) + )} +