commit 009a214b4063d7f145ade4dcda4d247f6368aad6 Author: Tatiana Nikolaeva Date: Fri Apr 4 21:41:22 2025 +0500 components 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 ? ( +