From 05d5d396b884258de099890842cfde8a4bc5d3f7 Mon Sep 17 00:00:00 2001 From: Tatiana Nikolaeva Date: Sat, 5 Apr 2025 21:14:19 +0500 Subject: [PATCH] styles type Dropdown --- SurveyFrontend/public/arrow_drop_down.svg | 3 ++ SurveyFrontend/public/arrow_drop_up.svg | 3 ++ .../public/radio_button_unchecked.svg | 3 ++ .../components/AnswerOption/AnswerOption.tsx | 18 ++++++++-- .../QuestionItem/QuestionItem.module.css | 7 +++- .../components/QuestionItem/QuestionItem.tsx | 21 +++++++----- .../TypeDropdown/TypeDropdown.module.css | 34 +++++++++---------- .../components/TypeDropdown/TypeDropdown.tsx | 20 ++++++++--- 8 files changed, 74 insertions(+), 35 deletions(-) create mode 100644 SurveyFrontend/public/arrow_drop_down.svg create mode 100644 SurveyFrontend/public/arrow_drop_up.svg create mode 100644 SurveyFrontend/public/radio_button_unchecked.svg diff --git a/SurveyFrontend/public/arrow_drop_down.svg b/SurveyFrontend/public/arrow_drop_down.svg new file mode 100644 index 0000000..1d700de --- /dev/null +++ b/SurveyFrontend/public/arrow_drop_down.svg @@ -0,0 +1,3 @@ + + + diff --git a/SurveyFrontend/public/arrow_drop_up.svg b/SurveyFrontend/public/arrow_drop_up.svg new file mode 100644 index 0000000..d891272 --- /dev/null +++ b/SurveyFrontend/public/arrow_drop_up.svg @@ -0,0 +1,3 @@ + + + diff --git a/SurveyFrontend/public/radio_button_unchecked.svg b/SurveyFrontend/public/radio_button_unchecked.svg new file mode 100644 index 0000000..a99050b --- /dev/null +++ b/SurveyFrontend/public/radio_button_unchecked.svg @@ -0,0 +1,3 @@ + + + diff --git a/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx b/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx index cd84857..8645966 100644 --- a/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx +++ b/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx @@ -1,14 +1,18 @@ import React, {useState, useRef, useEffect} from "react"; import styles from'./AnswerOption.module.css'; +const single_selected_response = '../../../public/radio_button_checked.svg'; +const multiple_selected_response = '../../../public/check_box.svg'; +// const single_response = + interface AnswerOptionProps{ - src: string; index: number; value: string; onChange: (value: string) => void; + selectedType: 'single' | 'multiply'; } -const AnswerOption: React.FC = ({src, index, value, onChange}) => { +const AnswerOption: React.FC = ({index, value, onChange, selectedType}) => { const [currentValue, setCurrentValue] = useState(value); const [isEditing, setIsEditing] = useState(false); //редактируется ли сейчас @@ -48,9 +52,17 @@ const AnswerOption: React.FC = ({src, index, value, onChange} } }, [isEditing]); + const getImage = (typeValue: string): string => { + if (typeValue === 'multiply') { + return multiple_selected_response; + } else { + return single_selected_response; + } + }; + return (
- + {isEditing ? (