From 065917b4d237c3f2e295af08df26f4c872fe54b4 Mon Sep 17 00:00:00 2001 From: Tatiana Nikolaeva Date: Sat, 5 Apr 2025 22:42:57 +0500 Subject: [PATCH] change QuestionList, style QuestionItem --- .../QuestionItem/QuestionItem.module.css | 29 ++++++++++++++++--- .../components/QuestionItem/QuestionItem.tsx | 4 +-- .../QuestionsList/QuestionsList.tsx | 18 +++++++++--- .../SurveyInfo/SurveyInfo.module.css | 2 ++ 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/SurveyFrontend/src/components/QuestionItem/QuestionItem.module.css b/SurveyFrontend/src/components/QuestionItem/QuestionItem.module.css index 19801bd..0894eaa 100644 --- a/SurveyFrontend/src/components/QuestionItem/QuestionItem.module.css +++ b/SurveyFrontend/src/components/QuestionItem/QuestionItem.module.css @@ -9,11 +9,32 @@ border-radius: 14px; } -.questionCard:last-child{ - margin-bottom: 0; -} - .questionContainer{ display: flex; flex-direction: column; +} + +.questionTextarea{ + border: none; + outline: none; + resize: none; + margin-bottom: 5px; + font-size: 24px; + font-weight: 600; +} + +.buttonQuestion{ + border: none; + outline: none; + background-color: #ffffff; + padding: 0; +} + +.textQuestion{ + margin-top: 0; + width: 100%; + font-size: 24px; + font-weight: 600; + margin-bottom: 35px; + text-align: start; } \ No newline at end of file diff --git a/SurveyFrontend/src/components/QuestionItem/QuestionItem.tsx b/SurveyFrontend/src/components/QuestionItem/QuestionItem.tsx index 7dffed7..8d6988c 100644 --- a/SurveyFrontend/src/components/QuestionItem/QuestionItem.tsx +++ b/SurveyFrontend/src/components/QuestionItem/QuestionItem.tsx @@ -83,8 +83,8 @@ const QuestionItem: React.FC = ({indexQuestion, initialTextQu placeholder={initialTextQuestion} /> ) : ( - )} {answerOption.map((answerText, index) => ( diff --git a/SurveyFrontend/src/components/QuestionsList/QuestionsList.tsx b/SurveyFrontend/src/components/QuestionsList/QuestionsList.tsx index e7bd32a..64c4ecc 100644 --- a/SurveyFrontend/src/components/QuestionsList/QuestionsList.tsx +++ b/SurveyFrontend/src/components/QuestionsList/QuestionsList.tsx @@ -6,20 +6,28 @@ interface QuestionsListProps {} interface Question { id: number; + text: string } const QuestionsList: React.FC = () => { const [questions, setQuestions] = useState([ - {id: 1}, + {id: 1, text: ''}, ]); const handleAddQuestion = () => { - // Find the highest ID in the current questions list const maxId = questions.reduce((max, question) => Math.max(max, question.id), 0); const newQuestion: Question = { - id: maxId + 1, // Increment the ID + id: maxId + 1, + text: '' }; - setQuestions([...questions, newQuestion]); // Add the new question to the state + setQuestions([...questions, newQuestion]); + }; + + const handleQuestionChange = (index: number, value: string) => { + const newQuestions = [...questions]; + newQuestions[index] = {...newQuestions[index], text: value}; + + setQuestions(newQuestions); }; return ( @@ -28,6 +36,8 @@ const QuestionsList: React.FC = () => { handleQuestionChange(index, value)} /> ))} diff --git a/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.module.css b/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.module.css index 01a380a..f6e8c7c 100644 --- a/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.module.css +++ b/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.module.css @@ -24,12 +24,14 @@ text-align: center; font-size: 20px; font-weight: 600; + line-height: 20px; margin-bottom: 23px; word-break: break-word; padding: 0; } .textareaTitle{ + margin-top: -17px; width: 80%; padding-top: 35px; resize: none;