From 5b2803e67a7b390e2360d40510b65958b187f48d Mon Sep 17 00:00:00 2001 From: Tatiana Nikolaeva Date: Sat, 5 Apr 2025 23:43:40 +0500 Subject: [PATCH 1/2] Correcting account styles --- SurveyFrontend/src/components/Account/Account.module.css | 2 +- SurveyFrontend/src/components/Survey/Survey.module.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SurveyFrontend/src/components/Account/Account.module.css b/SurveyFrontend/src/components/Account/Account.module.css index 8619ffd..cbbfd5e 100644 --- a/SurveyFrontend/src/components/Account/Account.module.css +++ b/SurveyFrontend/src/components/Account/Account.module.css @@ -1,12 +1,12 @@ /*Account.module.css*/ .account { - width: 15%; background-color: #F3F3F3; border-radius: 40px; align-items: center; padding: 4.58px 13px 4.58px 4.58px; margin: 26px 33px 27px 0; + margin-left: auto; } .accountText{ diff --git a/SurveyFrontend/src/components/Survey/Survey.module.css b/SurveyFrontend/src/components/Survey/Survey.module.css index cbc28c7..1b26be4 100644 --- a/SurveyFrontend/src/components/Survey/Survey.module.css +++ b/SurveyFrontend/src/components/Survey/Survey.module.css @@ -1,6 +1,6 @@ /*Survey.module.css*/ .survey{ - width: 63%; + width: 65%; margin-left: 8.9%; } \ No newline at end of file From 8c1bd2e3b8caa32e6d883c4fb8e52f684f336386 Mon Sep 17 00:00:00 2001 From: Tatiana Nikolaeva Date: Tue, 8 Apr 2025 00:33:20 +0500 Subject: [PATCH 2/2] deleting questions and answers, selecting answers --- SurveyFrontend/public/delete.svg | 3 + SurveyFrontend/public/deleteQuestion.svg | 3 + SurveyFrontend/public/emptyCheckbox.svg | 10 +++ .../AnswerOption/AnswerOption.module.css | 17 ++++ .../components/AnswerOption/AnswerOption.tsx | 32 +++++--- .../MainComponent/MainComponent.module.css | 1 + .../QuestionItem/QuestionItem.module.css | 34 ++++++++ .../components/QuestionItem/QuestionItem.tsx | 81 ++++++++++++++----- .../QuestionsList/QuestionsList.tsx | 28 ++++--- .../TypeDropdown/TypeDropdown.module.css | 12 +-- 10 files changed, 174 insertions(+), 47 deletions(-) create mode 100644 SurveyFrontend/public/delete.svg create mode 100644 SurveyFrontend/public/deleteQuestion.svg create mode 100644 SurveyFrontend/public/emptyCheckbox.svg diff --git a/SurveyFrontend/public/delete.svg b/SurveyFrontend/public/delete.svg new file mode 100644 index 0000000..47f0621 --- /dev/null +++ b/SurveyFrontend/public/delete.svg @@ -0,0 +1,3 @@ + + + diff --git a/SurveyFrontend/public/deleteQuestion.svg b/SurveyFrontend/public/deleteQuestion.svg new file mode 100644 index 0000000..8766ff1 --- /dev/null +++ b/SurveyFrontend/public/deleteQuestion.svg @@ -0,0 +1,3 @@ + + + diff --git a/SurveyFrontend/public/emptyCheckbox.svg b/SurveyFrontend/public/emptyCheckbox.svg new file mode 100644 index 0000000..f61b1f8 --- /dev/null +++ b/SurveyFrontend/public/emptyCheckbox.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/SurveyFrontend/src/components/AnswerOption/AnswerOption.module.css b/SurveyFrontend/src/components/AnswerOption/AnswerOption.module.css index 265d390..6a0ec90 100644 --- a/SurveyFrontend/src/components/AnswerOption/AnswerOption.module.css +++ b/SurveyFrontend/src/components/AnswerOption/AnswerOption.module.css @@ -1,16 +1,26 @@ /*AnswerOption.module.css*/ .answer{ + width: 100%; display: flex; gap: 10px; margin-bottom: 17px; } .textAnswer{ + text-align: left; border: none; background-color: #ffffff; font-size: 18px; font-weight: 500; + word-break: break-word; + width: 70%; +} + +.buttonMarker{ + padding: 0; + border: none; + background-color: transparent; } .answerIcon{ @@ -28,4 +38,11 @@ display: flex; align-items: center; box-sizing: border-box; +} + +.deleteButton{ + margin-left: auto; + border: none; + background-color: transparent; + padding: 0; } \ No newline at end of file diff --git a/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx b/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx index 03a1e6f..e0c78b1 100644 --- a/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx +++ b/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx @@ -3,17 +3,20 @@ 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 = -// const multiple_response = +const single_response = '../../../public/radio_button_unchecked.svg'; +const multiple_response ='../../../public/emptyCheckbox.svg'; interface AnswerOptionProps{ index: number; value: string; onChange: (value: string) => void; + onDelete:(index: number) => void; selectedType: 'single' | 'multiply'; + isSelected: boolean; + toggleSelect: () => void; } -const AnswerOption: React.FC = ({index, value, onChange, selectedType}) => { +const AnswerOption: React.FC = ({index, value, onChange, onDelete, selectedType, isSelected, toggleSelect}) => { const [currentValue, setCurrentValue] = useState(value); const [isEditing, setIsEditing] = useState(false); @@ -33,12 +36,12 @@ const AnswerOption: React.FC = ({index, value, onChange, sele const handleSave = () => { setIsEditing(false); - onChange(currentValue); // Отправляем измененное значение родителю + onChange(currentValue); }; const handleKeyDown = (event: React.KeyboardEvent) => { if (event.key === "Enter") { - event.preventDefault(); // Предотвращаем перенос строки в textarea + event.preventDefault(); handleSave(); } }; @@ -53,17 +56,23 @@ const AnswerOption: React.FC = ({index, value, onChange, sele } }, [isEditing]); - const getImage = (typeValue: string): string => { - if (typeValue === 'multiply') { - return multiple_selected_response; + const getImage = () => { + if (selectedType === 'multiply') { + return isSelected ? multiple_selected_response : multiple_response; } else { - return single_selected_response; + return isSelected ? single_selected_response : single_response; } }; return (
- + {isEditing ? (