Commit beab242a authored by jang dong hyeok's avatar jang dong hyeok
Browse files

.

parent 4c74350f
...@@ -23,8 +23,6 @@ export const Question = ({ ...@@ -23,8 +23,6 @@ export const Question = ({
const [question, setQuestion] = useState(element); const [question, setQuestion] = useState(element);
const isEditing = question.isEditing; const isEditing = question.isEditing;
const [questions, setQuestions] = useState();
async function handleEditComplete() { async function handleEditComplete() {
question.content.choices.map((choice) => { question.content.choices.map((choice) => {
if (choice.text.trim() === "") { if (choice.text.trim() === "") {
...@@ -86,12 +84,11 @@ export const Question = ({ ...@@ -86,12 +84,11 @@ export const Question = ({
const dropResult = monitor.getDropResult<DropResult>(); const dropResult = monitor.getDropResult<DropResult>();
if (item && dropResult) { if (item && dropResult) {
alert(`You dropped ${item.name}`); alert(`You dropped ${item.name}`);
} else {
alert("you dropped wrong place");
} }
}, },
collect: (monitor) => ({ collect: (monitor) => ({
isDragging: monitor.isDragging(), isDragging: monitor.isDragging(),
handlerId: monitor.getHandlerId(),
}), }),
})); }));
...@@ -101,22 +98,19 @@ export const Question = ({ ...@@ -101,22 +98,19 @@ export const Question = ({
isOver: monitor.isOver(), isOver: monitor.isOver(),
canDrop: monitor.canDrop(), canDrop: monitor.canDrop(),
}), }),
hover(item, monitor) {
if (!isDragging) {
return;
}
},
})); }));
// //
return ( return (
<div <div ref={drop} className="flex w-full h-full justify-center">
ref={drop}
className="flex w-4/5 h-full justify-center"
style={{
border: isOver ? "dotted" : "",
}}
>
<div <div
ref={drag} ref={drag}
style={{ style={{ borderColor: isEditing ? "red" : "#0A8A8A" }}
borderColor: isEditing ? "red" : "#0A8A8A",
}}
className={ className={
"flex flex-col container w-full h-auto border-2 items-center m-3 py-2 rounded-lg cursor-move " "flex flex-col container w-full h-auto border-2 items-center m-3 py-2 rounded-lg cursor-move "
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment