From 009a214b4063d7f145ade4dcda4d247f6368aad6 Mon Sep 17 00:00:00 2001 From: Tatiana Nikolaeva Date: Fri, 4 Apr 2025 21:41:22 +0500 Subject: [PATCH] components --- SurveyFrontend/public/account.svg | 3 + SurveyFrontend/public/add_circle.svg | 3 + SurveyFrontend/public/logo.svg | 3 + .../src/components/Account/Account.module.css | 9 ++ .../src/components/Account/Account.tsx | 16 ++++ .../AddAnswerButton.module.css | 16 ++++ .../AddAnswerButton/AddAnswerButton.tsx | 17 ++++ .../AddQuestionButton.module.css | 18 ++++ .../AddQuestionButton/AddQuestionButton.tsx | 17 ++++ .../AnswerOption/AnswerOption.module.css | 23 +++++ .../components/AnswerOption/AnswerOption.tsx | 72 +++++++++++++++ .../src/components/Header/Header.module.css | 9 ++ .../src/components/Header/Header.tsx | 28 ++++++ .../src/components/Logo/Logo.module.css | 9 ++ SurveyFrontend/src/components/Logo/Logo.tsx | 16 ++++ .../MainComponent/MainComponent.module.css | 5 ++ .../MainComponent/MainComponent.tsx | 24 +++++ .../Navigation/Navigation.module.css | 12 +++ .../src/components/Navigation/Navigation.tsx | 34 ++++++++ .../NavigationItem/NavigationItem.module.css | 17 ++++ .../NavigationItem/NavigationItem.tsx | 20 +++++ .../PageSurvey/PageSurvey.module.css | 36 ++++++++ .../src/components/PageSurvey/PageSurvey.tsx | 20 +++++ .../QuestionItem/QuestionItem.module.css | 18 ++++ .../components/QuestionItem/QuestionItem.tsx | 66 ++++++++++++++ .../QuestionsList/QuestionsList.module.css | 2 + .../QuestionsList/QuestionsList.tsx | 38 ++++++++ .../SaveButton/SaveButton.module.css | 15 ++++ .../src/components/SaveButton/SaveButton.tsx | 16 ++++ .../src/components/Survey/Survey.module.css | 6 ++ .../src/components/Survey/Survey.tsx | 15 ++++ .../SurveyInfo/SurveyInfo.module.css | 73 ++++++++++++++++ .../src/components/SurveyInfo/SurveyInfo.tsx | 87 +++++++++++++++++++ .../SurveyPagesList.module.css | 7 ++ .../SurveyPagesList/SurveyPagesList.tsx | 27 ++++++ .../TypeDropdown/TypeDropdown.module.css | 69 +++++++++++++++ .../components/TypeDropdown/TypeDropdown.tsx | 87 +++++++++++++++++++ SurveyFrontend/src/pages/Questions.tsx | 13 +++ SurveyFrontend/src/pages/Results.tsx | 0 SurveyFrontend/src/pages/Settings.tsx | 0 40 files changed, 966 insertions(+) create mode 100644 SurveyFrontend/public/account.svg create mode 100644 SurveyFrontend/public/add_circle.svg create mode 100644 SurveyFrontend/public/logo.svg create mode 100644 SurveyFrontend/src/components/Account/Account.module.css create mode 100644 SurveyFrontend/src/components/Account/Account.tsx create mode 100644 SurveyFrontend/src/components/AddAnswerButton/AddAnswerButton.module.css create mode 100644 SurveyFrontend/src/components/AddAnswerButton/AddAnswerButton.tsx create mode 100644 SurveyFrontend/src/components/AddQuestionButton/AddQuestionButton.module.css create mode 100644 SurveyFrontend/src/components/AddQuestionButton/AddQuestionButton.tsx create mode 100644 SurveyFrontend/src/components/AnswerOption/AnswerOption.module.css create mode 100644 SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx create mode 100644 SurveyFrontend/src/components/Header/Header.module.css create mode 100644 SurveyFrontend/src/components/Header/Header.tsx create mode 100644 SurveyFrontend/src/components/Logo/Logo.module.css create mode 100644 SurveyFrontend/src/components/Logo/Logo.tsx create mode 100644 SurveyFrontend/src/components/MainComponent/MainComponent.module.css create mode 100644 SurveyFrontend/src/components/MainComponent/MainComponent.tsx create mode 100644 SurveyFrontend/src/components/Navigation/Navigation.module.css create mode 100644 SurveyFrontend/src/components/Navigation/Navigation.tsx create mode 100644 SurveyFrontend/src/components/NavigationItem/NavigationItem.module.css create mode 100644 SurveyFrontend/src/components/NavigationItem/NavigationItem.tsx create mode 100644 SurveyFrontend/src/components/PageSurvey/PageSurvey.module.css create mode 100644 SurveyFrontend/src/components/PageSurvey/PageSurvey.tsx create mode 100644 SurveyFrontend/src/components/QuestionItem/QuestionItem.module.css create mode 100644 SurveyFrontend/src/components/QuestionItem/QuestionItem.tsx create mode 100644 SurveyFrontend/src/components/QuestionsList/QuestionsList.module.css create mode 100644 SurveyFrontend/src/components/QuestionsList/QuestionsList.tsx create mode 100644 SurveyFrontend/src/components/SaveButton/SaveButton.module.css create mode 100644 SurveyFrontend/src/components/SaveButton/SaveButton.tsx create mode 100644 SurveyFrontend/src/components/Survey/Survey.module.css create mode 100644 SurveyFrontend/src/components/Survey/Survey.tsx create mode 100644 SurveyFrontend/src/components/SurveyInfo/SurveyInfo.module.css create mode 100644 SurveyFrontend/src/components/SurveyInfo/SurveyInfo.tsx create mode 100644 SurveyFrontend/src/components/SurveyPagesList/SurveyPagesList.module.css create mode 100644 SurveyFrontend/src/components/SurveyPagesList/SurveyPagesList.tsx create mode 100644 SurveyFrontend/src/components/TypeDropdown/TypeDropdown.module.css create mode 100644 SurveyFrontend/src/components/TypeDropdown/TypeDropdown.tsx create mode 100644 SurveyFrontend/src/pages/Questions.tsx create mode 100644 SurveyFrontend/src/pages/Results.tsx create mode 100644 SurveyFrontend/src/pages/Settings.tsx diff --git a/SurveyFrontend/public/account.svg b/SurveyFrontend/public/account.svg new file mode 100644 index 0000000..031e074 --- /dev/null +++ b/SurveyFrontend/public/account.svg @@ -0,0 +1,3 @@ + + + diff --git a/SurveyFrontend/public/add_circle.svg b/SurveyFrontend/public/add_circle.svg new file mode 100644 index 0000000..35a1a64 --- /dev/null +++ b/SurveyFrontend/public/add_circle.svg @@ -0,0 +1,3 @@ + + + diff --git a/SurveyFrontend/public/logo.svg b/SurveyFrontend/public/logo.svg new file mode 100644 index 0000000..f030325 --- /dev/null +++ b/SurveyFrontend/public/logo.svg @@ -0,0 +1,3 @@ + + + diff --git a/SurveyFrontend/src/components/Account/Account.module.css b/SurveyFrontend/src/components/Account/Account.module.css new file mode 100644 index 0000000..5254866 --- /dev/null +++ b/SurveyFrontend/src/components/Account/Account.module.css @@ -0,0 +1,9 @@ +/*Account.module.css*/ + +.account { + margin: 0; + padding: 0; + width: 52px; + height: 52px; + margin: 31px 39px 25px 0; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/Account/Account.tsx b/SurveyFrontend/src/components/Account/Account.tsx new file mode 100644 index 0000000..be12c02 --- /dev/null +++ b/SurveyFrontend/src/components/Account/Account.tsx @@ -0,0 +1,16 @@ +import React from 'react'; +import styles from './Account.module.css' + +interface AccountProps { + href: string +} + +const Account: React.FC = ({href}) => { + return ( + + Личный кабинет + + ); +}; + +export default Account; \ No newline at end of file diff --git a/SurveyFrontend/src/components/AddAnswerButton/AddAnswerButton.module.css b/SurveyFrontend/src/components/AddAnswerButton/AddAnswerButton.module.css new file mode 100644 index 0000000..1f95821 --- /dev/null +++ b/SurveyFrontend/src/components/AddAnswerButton/AddAnswerButton.module.css @@ -0,0 +1,16 @@ +/*AddAnswerButton.module.css*/ + +.answerButton { + display: flex; + gap: 10px; + align-items: center; + border: none; + background-color: white; + color: #3788D6; + font-size: 18px; + font-weight: 500; +} + +.addAnswerImg{ + vertical-align: middle; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/AddAnswerButton/AddAnswerButton.tsx b/SurveyFrontend/src/components/AddAnswerButton/AddAnswerButton.tsx new file mode 100644 index 0000000..7bb3b30 --- /dev/null +++ b/SurveyFrontend/src/components/AddAnswerButton/AddAnswerButton.tsx @@ -0,0 +1,17 @@ +import React from "react"; +import styles from './AddAnswerButton.module.css' + +interface AddAnswerButtonProps { + onClick(): void; +} + +const AddAnswerButton: React.FC = ({onClick}) => { + return ( + + ); +}; + +export default AddAnswerButton; \ No newline at end of file diff --git a/SurveyFrontend/src/components/AddQuestionButton/AddQuestionButton.module.css b/SurveyFrontend/src/components/AddQuestionButton/AddQuestionButton.module.css new file mode 100644 index 0000000..642abe1 --- /dev/null +++ b/SurveyFrontend/src/components/AddQuestionButton/AddQuestionButton.module.css @@ -0,0 +1,18 @@ +/*AddQuestionButton.module.css*/ + +.questionButton{ + background-color: #F6F6F6; + font-size: 24px; + font-weight: 600; + border: none; + margin: 104px auto 80px; + display: flex; + flex-direction: column; +} + +.questionButtonImg{ + vertical-align: middle; + margin: 0 auto; + margin-bottom: 16px; + width: 54px; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/AddQuestionButton/AddQuestionButton.tsx b/SurveyFrontend/src/components/AddQuestionButton/AddQuestionButton.tsx new file mode 100644 index 0000000..9d71446 --- /dev/null +++ b/SurveyFrontend/src/components/AddQuestionButton/AddQuestionButton.tsx @@ -0,0 +1,17 @@ +import React from "react"; +import styles from './AddQuestionButton.module.css' + +interface AddQuestionButtonProps { + onClick: () => void; +} + +const AddQuestionButton: React.FC = ({onClick}) => { + return ( + + ); +}; + +export default AddQuestionButton; \ No newline at end of file diff --git a/SurveyFrontend/src/components/AnswerOption/AnswerOption.module.css b/SurveyFrontend/src/components/AnswerOption/AnswerOption.module.css new file mode 100644 index 0000000..b4ca193 --- /dev/null +++ b/SurveyFrontend/src/components/AnswerOption/AnswerOption.module.css @@ -0,0 +1,23 @@ +/*AnswerOption.module.css*/ + +.answer{ + display: flex; + gap: 10px; + margin-bottom: 17px; +} + +.textAnswer{ + font-size: 18px; + font-weight: 500; + align-items: center; +} + +.answerIcon{ + vertical-align: middle; +} + +.answerInput{ + outline: none; + border: none; + resize: none; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx b/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx new file mode 100644 index 0000000..944d187 --- /dev/null +++ b/SurveyFrontend/src/components/AnswerOption/AnswerOption.tsx @@ -0,0 +1,72 @@ +import React, {useState, useRef, useEffect} from "react"; +import styles from'./AnswerOption.module.css'; + +interface AnswerOptionProps{ + src: string; + index: number; + value: string; + onChange: (value: string) => void; +} + +const AnswerOption: React.FC = ({src, index, value, onChange}) => { + const [currentValue, setCurrentValue] = useState(value); + const [isEditing, setIsEditing] = useState(false); //редактируется ли сейчас + + const textAreaRef = useRef(null); + + useEffect(() => { + setCurrentValue(value); + }, [value]); + + const handleSpanClick = () => { + setIsEditing(true); + } + + const handleTextareaChange = (event: React.ChangeEvent) => { + setCurrentValue(event.target.value); + }; + + const handleSave = () => { + setIsEditing(false); + onChange(currentValue); // Отправляем измененное значение родителю + }; + + const handleKeyDown = (event: React.KeyboardEvent) => { + if (event.key === "Enter") { + event.preventDefault(); // Предотвращаем перенос строки в textarea + handleSave(); + } + }; + + const handleBlur = () => { + handleSave(); + }; + + useEffect(() => { + if (isEditing && textAreaRef.current) { + textAreaRef.current.focus(); + } + }, [isEditing]); + + return ( +
+ + {isEditing ? ( +