Commit 0c9bb460 authored by Yoon, Daeki's avatar Yoon, Daeki 😅
Browse files

코드 정리

parent b9b919e7
...@@ -7,9 +7,11 @@ import { RDropdownForm } from "./RDropdownForm"; ...@@ -7,9 +7,11 @@ import { RDropdownForm } from "./RDropdownForm";
import { RFileForm } from "./RFileForm"; import { RFileForm } from "./RFileForm";
import { RRatingForm } from "./RRatingForm"; import { RRatingForm } from "./RRatingForm";
import { RDateForm } from "./RDateForm"; import { RDateForm } from "./RDateForm";
type AccordionProps = { type AccordionProps = {
question: BasicQuestionType; question: BasicQuestionType;
}; };
export const Accordion = ({ question }: AccordionProps) => { export const Accordion = ({ question }: AccordionProps) => {
const [isOpened, setOpened] = useState<boolean>(false); const [isOpened, setOpened] = useState<boolean>(false);
const [height, setHeight] = useState<string>("0px"); const [height, setHeight] = useState<string>("0px");
...@@ -39,7 +41,9 @@ export const Accordion = ({ question }: AccordionProps) => { ...@@ -39,7 +41,9 @@ export const Accordion = ({ question }: AccordionProps) => {
return <></>; return <></>;
} }
} }
console.log(question);
// console.log(question);
return ( return (
<div className="p-1"> <div className="p-1">
<div onClick={HandleOpening}> <div onClick={HandleOpening}>
......
...@@ -10,11 +10,11 @@ export const RDropdownForm = ({ question }: Props) => { ...@@ -10,11 +10,11 @@ export const RDropdownForm = ({ question }: Props) => {
acc[cur] = (acc[cur] || 0) + 1; acc[cur] = (acc[cur] || 0) + 1;
return acc; return acc;
}, {}); }, {});
console.log(result);
return ( return (
<div className="m-5"> <div className="m-5">
{question.content.choices.map((choice: any) => ( {question.content.choices.map((choice: any, index: number) => (
<div className=""> <div key={index} className="">
<span className="font-bold">{choice.text}</span> <span className="font-bold">{choice.text}</span>
<span className="ml-3"> <span className="ml-3">
- {result[choice.text] ? result[choice.text] : 0} - {result[choice.text] ? result[choice.text] : 0}
......
...@@ -8,8 +8,10 @@ type Props = { ...@@ -8,8 +8,10 @@ type Props = {
export const REssayForm = ({ question }: Props) => { export const REssayForm = ({ question }: Props) => {
return ( return (
<div className="m-5"> <div className="m-5">
{question.answers.map((answer: any) => ( {question.answers.map((answer: any, index: number) => (
<div className="font-bold">{answer}</div> <div key={index} className="font-bold">
{answer}
</div>
))} ))}
</div> </div>
); );
......
...@@ -10,12 +10,12 @@ export const RRadioForm = ({ question }: Props) => { ...@@ -10,12 +10,12 @@ export const RRadioForm = ({ question }: Props) => {
acc[cur] = (acc[cur] || 0) + 1; acc[cur] = (acc[cur] || 0) + 1;
return acc; return acc;
}, {}); }, {});
console.log(result); // console.log(result);
return ( return (
<div className="m-5"> <div className="m-5">
{question.content.choices.map((choice: any) => ( {question.content.choices.map((choice: any, index: number) => (
<div className=""> <div key={index} className="">
<span className="font-bold">{choice.text}</span> <span className="font-bold">{choice.text}</span>
<span className="ml-3"> <span className="ml-3">
- {result[choice.text] ? result[choice.text] : 0} - {result[choice.text] ? result[choice.text] : 0}
......
...@@ -37,7 +37,7 @@ export const EditSurvey = () => { ...@@ -37,7 +37,7 @@ export const EditSurvey = () => {
const initEditing = thisSurvey.questions.map((question) => { const initEditing = thisSurvey.questions.map((question) => {
return { qid: question._id, isEditing: false }; return { qid: question._id, isEditing: false };
}); });
console.log("init editing", initEditing); // console.log("init editing", initEditing);
setIsEditing(initEditing); setIsEditing(initEditing);
setSurvey(thisSurvey); setSurvey(thisSurvey);
...@@ -148,8 +148,8 @@ export const EditSurvey = () => { ...@@ -148,8 +148,8 @@ export const EditSurvey = () => {
} }
const questions = survey.questions; const questions = survey.questions;
console.log(questions); // console.log(questions);
console.log("isediting", isEditing); // console.log("isediting", isEditing);
return ( return (
<> <>
......
...@@ -26,7 +26,7 @@ export const ResultSurvey = () => { ...@@ -26,7 +26,7 @@ export const ResultSurvey = () => {
try { try {
if (surveyId) { if (surveyId) {
const survey = await answerApi.getAnswers(surveyId); const survey = await answerApi.getAnswers(surveyId);
console.log(survey); // console.log(survey);
setSurvey(survey); setSurvey(survey);
} else { } else {
setLoading(true); setLoading(true);
...@@ -37,6 +37,7 @@ export const ResultSurvey = () => { ...@@ -37,6 +37,7 @@ export const ResultSurvey = () => {
setLoading(false); setLoading(false);
} }
} }
return ( return (
<div className="flex flex-col place-items-center"> <div className="flex flex-col place-items-center">
<div className="flex flex-col container place-items-center mt-4"> <div className="flex flex-col container place-items-center mt-4">
......
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