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 ? ( + + ) : ( + + {currentValue || `Ответ ${index}`} + + )} + + ); +}; + +export default AnswerOption; \ No newline at end of file diff --git a/SurveyFrontend/src/components/Header/Header.module.css b/SurveyFrontend/src/components/Header/Header.module.css new file mode 100644 index 0000000..d1cc245 --- /dev/null +++ b/SurveyFrontend/src/components/Header/Header.module.css @@ -0,0 +1,9 @@ +/*Header.module.css*/ + +.header{ + margin: 0; + padding: 0; + width: 100%; + display: flex; + /*justify-content: space-between;*/ +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/Header/Header.tsx b/SurveyFrontend/src/components/Header/Header.tsx new file mode 100644 index 0000000..56d25bd --- /dev/null +++ b/SurveyFrontend/src/components/Header/Header.tsx @@ -0,0 +1,28 @@ +import React, {useState} from "react"; +import Logo from "../Logo/Logo.tsx"; +import Account from "../Account/Account.tsx"; +import styles from './Header.module.css' +import SurveyPagesList from "../SurveyPagesList/SurveyPagesList.tsx"; + +interface HeaderProps {} + +const Header: React.FC = () => { + const [activePage, setActivePage] = useState('Создать опрос'); + + const handlePageClick = (name: string)=> { + setActivePage(name); + } + + return ( + + + + + + ); +}; + +export default Header; \ No newline at end of file diff --git a/SurveyFrontend/src/components/Logo/Logo.module.css b/SurveyFrontend/src/components/Logo/Logo.module.css new file mode 100644 index 0000000..d0ce0c7 --- /dev/null +++ b/SurveyFrontend/src/components/Logo/Logo.module.css @@ -0,0 +1,9 @@ +/*Logo.module.css*/ + +.logo { + margin: 0; + padding: 0; + height: 52px; + width: 52px; + margin: 31px auto 25px 40px; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/Logo/Logo.tsx b/SurveyFrontend/src/components/Logo/Logo.tsx new file mode 100644 index 0000000..61306c9 --- /dev/null +++ b/SurveyFrontend/src/components/Logo/Logo.tsx @@ -0,0 +1,16 @@ +import React from "react"; +import styles from './Logo.module.css' + +interface LogoProps { + href: string; +} + +const Logo: React.FC = ({href}) => { + return ( + + + + ); +}; + +export default Logo; \ No newline at end of file diff --git a/SurveyFrontend/src/components/MainComponent/MainComponent.module.css b/SurveyFrontend/src/components/MainComponent/MainComponent.module.css new file mode 100644 index 0000000..45a21a0 --- /dev/null +++ b/SurveyFrontend/src/components/MainComponent/MainComponent.module.css @@ -0,0 +1,5 @@ +.mainPage{ + width: 100%; + display: flex; + background-color: #F6F6F6; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/MainComponent/MainComponent.tsx b/SurveyFrontend/src/components/MainComponent/MainComponent.tsx new file mode 100644 index 0000000..9ee2f41 --- /dev/null +++ b/SurveyFrontend/src/components/MainComponent/MainComponent.tsx @@ -0,0 +1,24 @@ +import Navigation from "../Navigation/Navigation.tsx"; +import React, {useState} from "react"; +import styles from './MainComponent.module.css' +import Survey from "../Survey/Survey.tsx"; + +const MainComponent: React.FC = () => { + const [activePage, setActivePage] = useState('Вопросы'); + + const handleNavigationClick = (title: string) => { + setActivePage(title); + } + + return ( + + + + + ) +} + +export default MainComponent; \ No newline at end of file diff --git a/SurveyFrontend/src/components/Navigation/Navigation.module.css b/SurveyFrontend/src/components/Navigation/Navigation.module.css new file mode 100644 index 0000000..2dff8e3 --- /dev/null +++ b/SurveyFrontend/src/components/Navigation/Navigation.module.css @@ -0,0 +1,12 @@ +/*Navigation.module.css*/ + +.nav{ + margin: 34px 0 48px 40px; + background-color: white; + border-radius: 20px; +} + +.navList{ + list-style: none; + padding: 52px 57px 70px 36px; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/Navigation/Navigation.tsx b/SurveyFrontend/src/components/Navigation/Navigation.tsx new file mode 100644 index 0000000..0b5cf01 --- /dev/null +++ b/SurveyFrontend/src/components/Navigation/Navigation.tsx @@ -0,0 +1,34 @@ +import React from 'react' +import styles from './Navigation.module.css' +import NavigationItem from "../NavigationItem/NavigationItem.tsx"; +import SaveButton from "../SaveButton/SaveButton.tsx"; + +interface NavigationProps { + onNavigationClick: (title: string) => void; + activePage: string +} + +const Navigation: React.FC = ({onNavigationClick, activePage}) => { + const items: string[] = ['Вопросы', 'Настройки', 'Результаты'] + + return ( + + + + {items.map(item => ( + onNavigationClick(item)} + /> + ))} + + + + + + ); +}; + +export default Navigation; \ No newline at end of file diff --git a/SurveyFrontend/src/components/NavigationItem/NavigationItem.module.css b/SurveyFrontend/src/components/NavigationItem/NavigationItem.module.css new file mode 100644 index 0000000..dac6de0 --- /dev/null +++ b/SurveyFrontend/src/components/NavigationItem/NavigationItem.module.css @@ -0,0 +1,17 @@ +/*NavigationItem.module.css*/ + +.navItem{ + font-weight: 600; + font-size: 24px; + color: #AFAFAF; + margin-bottom: 42px; +} + +.active{ + text-decoration: underline 2px #556FB7; + color: #000000;; +} + +.navItem:last-child{ + margin-bottom: 0; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/NavigationItem/NavigationItem.tsx b/SurveyFrontend/src/components/NavigationItem/NavigationItem.tsx new file mode 100644 index 0000000..7d0386a --- /dev/null +++ b/SurveyFrontend/src/components/NavigationItem/NavigationItem.tsx @@ -0,0 +1,20 @@ +import React from 'react' +import styles from './NavigationItem.module.css' + +interface NavigationItemProps{ + title: string; + onClick(): void; + isActive: boolean; //Дописать для активной ссылки, для класса +} + +const NavigationItem: React.FC = ({title, onClick, isActive}) => { + return ( + + + {title} + + + ); +}; + +export default NavigationItem; \ No newline at end of file diff --git a/SurveyFrontend/src/components/PageSurvey/PageSurvey.module.css b/SurveyFrontend/src/components/PageSurvey/PageSurvey.module.css new file mode 100644 index 0000000..ec0e96e --- /dev/null +++ b/SurveyFrontend/src/components/PageSurvey/PageSurvey.module.css @@ -0,0 +1,36 @@ +.pagesSurveyItem{ + font-size: 24px; + font-weight: 600; + color: #2A6DAE; +} + +.active{ + color: #000000; + text-decoration: underline; + text-decoration-color: #3881C8; + +} + +/*.pagesSurveyItem {*/ +/* font-size: 24px;*/ +/* font-weight: 600;*/ +/* color: #2A6DAE;*/ +/* position: relative; !* Necessary for positioning the underline *!*/ +/* display: inline-block; !* Makes the width only as wide as the content *!*/ +/*}*/ + +/*.active {*/ +/* color: #000000;*/ +/*}*/ + +/*.active::after {*/ +/* content: "";*/ +/* display: block; !* Makes it a block element for width/height control *!*/ +/* width: 96px;*/ +/* height: 2px; !* Adjust as needed for the thickness of the underline *!*/ +/* background-color: #3881C8;*/ +/* position: absolute;*/ +/* left: 50%; !* Center horizontally *!*/ +/* transform: translateX(-50%); !* Corrects the centering *!*/ +/* bottom: -5px; !* Position 5px below the text *!*/ +/*}*/ \ No newline at end of file diff --git a/SurveyFrontend/src/components/PageSurvey/PageSurvey.tsx b/SurveyFrontend/src/components/PageSurvey/PageSurvey.tsx new file mode 100644 index 0000000..f438406 --- /dev/null +++ b/SurveyFrontend/src/components/PageSurvey/PageSurvey.tsx @@ -0,0 +1,20 @@ +import React from 'react'; +import styles from './PageSurvey.module.css'; + +interface PageSurveyProps{ + name: string; + isActive: boolean; + onClick(): void; +} + +const PageSurvey: React.FC = ({name, isActive, onClick}) => { + return ( + + + {name} + + + ); +}; + +export default PageSurvey; \ No newline at end of file diff --git a/SurveyFrontend/src/components/QuestionItem/QuestionItem.module.css b/SurveyFrontend/src/components/QuestionItem/QuestionItem.module.css new file mode 100644 index 0000000..b6bf582 --- /dev/null +++ b/SurveyFrontend/src/components/QuestionItem/QuestionItem.module.css @@ -0,0 +1,18 @@ +/*QuestionItem.module.css*/ + +.questionCard{ + width: 100%; + background-color: white; + display: flex; + margin-bottom: 34px; + padding: 27px 29px 26px 36px; + border-radius: 14px; +} + +.questionCard:last-child{ + margin-bottom: 0; +} + +.questionContainer{ + +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/QuestionItem/QuestionItem.tsx b/SurveyFrontend/src/components/QuestionItem/QuestionItem.tsx new file mode 100644 index 0000000..f6d6cfc --- /dev/null +++ b/SurveyFrontend/src/components/QuestionItem/QuestionItem.tsx @@ -0,0 +1,66 @@ +import React, {useState} from "react"; +import AnswerOption from '../AnswerOption/AnswerOption'; +import AddAnswerButton from "../AddAnswerButton/AddAnswerButton.tsx"; +import TypeDropdown from "../TypeDropdown/TypeDropdown.tsx"; +import styles from './QuestionItem.module.css' + +import singleChoiceIcon from '../../../public/radio_button_checked.svg' +import multiplyChoiceIcon from '../../../public/check_box.svg' + +interface QuestionItemProps { + indexQuestion: number; + initialTextQuestion?: string; +} + +const QuestionItem: React.FC = ({indexQuestion, initialTextQuestion = `Вопрос ${indexQuestion}`}) => { + const [answerOption, setAnswerOption] = useState(['']); + const [questionType] = useState('single'); + const [textQuestion, setTextQuestion] = useState(initialTextQuestion); + + const handleAddAnswer = () => { + setAnswerOption([...answerOption, '']); + }; + + // const handleTypeChange = (type: string) => { + // setQuestionType(type); + // } + + const handleAnswerChange = (index: number, value: string) => { + const newAnswerOption = [...answerOption]; + newAnswerOption[index] = value; + setAnswerOption(newAnswerOption); + } + + const handleQuestionChange = (event: React.ChangeEvent) => { + setTextQuestion(event.target.value); + }; + + return ( + + + + + + {answerOption.map((answerText, index) => ( + handleAnswerChange(index, value)} + /> + ))} + + + + + + ); +} + +export default QuestionItem; \ No newline at end of file diff --git a/SurveyFrontend/src/components/QuestionsList/QuestionsList.module.css b/SurveyFrontend/src/components/QuestionsList/QuestionsList.module.css new file mode 100644 index 0000000..c150798 --- /dev/null +++ b/SurveyFrontend/src/components/QuestionsList/QuestionsList.module.css @@ -0,0 +1,2 @@ +/*QuestionsList.module.css*/ + diff --git a/SurveyFrontend/src/components/QuestionsList/QuestionsList.tsx b/SurveyFrontend/src/components/QuestionsList/QuestionsList.tsx new file mode 100644 index 0000000..e7bd32a --- /dev/null +++ b/SurveyFrontend/src/components/QuestionsList/QuestionsList.tsx @@ -0,0 +1,38 @@ +import React, {useState} from "react"; +import QuestionItem from "../QuestionItem/QuestionItem.tsx"; +import AddQuestionButton from "../AddQuestionButton/AddQuestionButton.tsx"; + +interface QuestionsListProps {} + +interface Question { + id: number; +} + +const QuestionsList: React.FC = () => { + const [questions, setQuestions] = useState([ + {id: 1}, + ]); + + 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 + }; + setQuestions([...questions, newQuestion]); // Add the new question to the state + }; + + return ( + <> + {questions.map((question, index) => ( + + ))} + + > + ); +}; + +export default QuestionsList; \ No newline at end of file diff --git a/SurveyFrontend/src/components/SaveButton/SaveButton.module.css b/SurveyFrontend/src/components/SaveButton/SaveButton.module.css new file mode 100644 index 0000000..88d3096 --- /dev/null +++ b/SurveyFrontend/src/components/SaveButton/SaveButton.module.css @@ -0,0 +1,15 @@ +/*SaveButton.module.css*/ + +.createSurveyButton { + /*width: 15%;*/ + margin-left: 40px; + padding: 25px 50.5px; + border: none; + border-radius: 20px; + background-color: #3788D6; + color: white; + font-weight: 700; + font-size: 24px; + text-align: center; + box-shadow: 0 0 7.4px 0 rgba(154, 202, 247, 1); +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/SaveButton/SaveButton.tsx b/SurveyFrontend/src/components/SaveButton/SaveButton.tsx new file mode 100644 index 0000000..d75ccf6 --- /dev/null +++ b/SurveyFrontend/src/components/SaveButton/SaveButton.tsx @@ -0,0 +1,16 @@ +import React from 'react' +import styles from './SaveButton.module.css' + +interface CreateSurveyButtonProps { + // onClick(): void; +} + +const SaveButton: React.FC = ({}) => { + return ( + + Сохранить + + ); +} + +export default SaveButton; \ No newline at end of file diff --git a/SurveyFrontend/src/components/Survey/Survey.module.css b/SurveyFrontend/src/components/Survey/Survey.module.css new file mode 100644 index 0000000..cbc28c7 --- /dev/null +++ b/SurveyFrontend/src/components/Survey/Survey.module.css @@ -0,0 +1,6 @@ +/*Survey.module.css*/ + +.survey{ + width: 63%; + margin-left: 8.9%; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/Survey/Survey.tsx b/SurveyFrontend/src/components/Survey/Survey.tsx new file mode 100644 index 0000000..7f96e12 --- /dev/null +++ b/SurveyFrontend/src/components/Survey/Survey.tsx @@ -0,0 +1,15 @@ +import React from "react"; +import SurveyInfo from "../SurveyInfo/SurveyInfo.tsx"; +import QuestionsList from "../QuestionsList/QuestionsList.tsx"; +import styles from './Survey.module.css' + +const Survey: React.FC = () => { + return ( + + + + + ); +} + +export default Survey; \ No newline at end of file diff --git a/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.module.css b/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.module.css new file mode 100644 index 0000000..ef9ef14 --- /dev/null +++ b/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.module.css @@ -0,0 +1,73 @@ +/*SurveyInfo.module.css*/ + +.blockInfo{ + background-color: #ffffff; + /*margin: 0;*/ + padding: 0; + width: 100%; + margin-top: 34px; + margin-bottom: 49px; + border-radius: 14px; + height: 191px; +} + +.info{ + display: block; + padding: 35px 0; +} + +.titleSurvey{ + resize: none; + text-align: center; + margin: 0; + padding: 0 20px; + font-size: 40px; + font-weight: 600; + margin-bottom: 23px; +} + +.textareaTitle{ + resize: none; + text-align: center; + font-size: 40px; + font-weight: 600; + margin: 0; + padding: 0; + border: none; + margin-bottom: 23px; +} + +.description{ + resize: none; + text-align: center; + margin: 0; + padding: 0 20px; + font-size: 24px; + font-weight: 500; +} + +.textareaDescrip{ + resize: none; + text-align: center; + margin: 0; + font-size: 22px; +} + +.descripButton{ + border: none; + background-color: #ffffff; + display: block; + margin: 0 auto; +} + +.descButtonImg{ + width: 28px; +} + +.textButton{ + vertical-align: center; + font-size: 24px; + font-weight: 500; + color: #7D7983; + padding: 10px; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.tsx b/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.tsx new file mode 100644 index 0000000..ec519df --- /dev/null +++ b/SurveyFrontend/src/components/SurveyInfo/SurveyInfo.tsx @@ -0,0 +1,87 @@ +import React, {useState} from "react"; +import styles from './SurveyInfo.module.css' + +interface SurveyInfoProps {} + +const SurveyInfo: React.FC = () => { + const [descriptionSurvey, setDescriptionSurvey] = useState(''); + const [titleSurvey, setTitleSurvey] = useState('Название опроса'); + const [showDescriptionField, setShowDescriptionField] = useState(false); + const [showNewTitleField, setShowNewTitleField] = useState(false); + + + const handleDescriptionChange = (descripEvent: React.ChangeEvent) => { + setDescriptionSurvey(descripEvent.target.value); + } + + const handleNewTitleChange = (titleEvent: React.ChangeEvent) => { + setTitleSurvey(titleEvent.target.value); + } + + const handleAddNewTitleClick = () => { + setShowNewTitleField(true); + } + + const handleAddDescriptionClick = () => { + setShowDescriptionField(true); + } + + const handleTitleKeyDown = (titleClickEnter: React.KeyboardEvent) => { + if (titleClickEnter.key === 'Enter'){ + titleClickEnter.preventDefault(); + setShowNewTitleField(false); + } + } + + const handleDescriptionKeyDown = (descripClickEnter: React.KeyboardEvent) => { + if (descripClickEnter.key === 'Enter'){ + descripClickEnter.preventDefault(); + setShowDescriptionField(false); + } + } + + const handleParagraphClick = () => { + setShowDescriptionField(true); + } + + return ( + + + { + showNewTitleField ? ( + + + + ) : ( + {titleSurvey} + ) + } + + {descriptionSurvey && !showDescriptionField ? ( + {descriptionSurvey} + ) : showDescriptionField ? ( + + + + ) : ( + + Добавить описание + + + )} + + + ); +}; + +export default SurveyInfo; \ No newline at end of file diff --git a/SurveyFrontend/src/components/SurveyPagesList/SurveyPagesList.module.css b/SurveyFrontend/src/components/SurveyPagesList/SurveyPagesList.module.css new file mode 100644 index 0000000..5c5df23 --- /dev/null +++ b/SurveyFrontend/src/components/SurveyPagesList/SurveyPagesList.module.css @@ -0,0 +1,7 @@ +.listSurveyPages{ + display: flex; + gap: 61px; + list-style: none; + align-items: center; + margin-right: 900px; +} \ No newline at end of file diff --git a/SurveyFrontend/src/components/SurveyPagesList/SurveyPagesList.tsx b/SurveyFrontend/src/components/SurveyPagesList/SurveyPagesList.tsx new file mode 100644 index 0000000..c61e8fa --- /dev/null +++ b/SurveyFrontend/src/components/SurveyPagesList/SurveyPagesList.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import styles from './SurveyPagesList.module.css'; +import PageSurvey from "../PageSurvey/PageSurvey.tsx"; + +interface SurveyPagesListProps{ + activePage: string; + onPageClick: (name: string) => void; +} + +const SurveyPagesList: React.FC = ({activePage, onPageClick}) => { + const listPages: string[] = ['Создать опрос', 'Мои опросы'] + + return ( + + {listPages.map((page) => ( + onPageClick(page)} + /> + ))} + + ); +}; + +export default SurveyPagesList; \ No newline at end of file diff --git a/SurveyFrontend/src/components/TypeDropdown/TypeDropdown.module.css b/SurveyFrontend/src/components/TypeDropdown/TypeDropdown.module.css new file mode 100644 index 0000000..8345472 --- /dev/null +++ b/SurveyFrontend/src/components/TypeDropdown/TypeDropdown.module.css @@ -0,0 +1,69 @@ +/*TypeDropdown.module.css*/ + +.dropdownContainer { + width: 22%; + position: relative; + display: inline-block; +} + +.dropdownButton { + background-color: #fff; + border: 1px solid #000000; + border-radius: 19px; + padding: 9px 7px 7px 10px; + font-size: 16px; + font-weight: 500; + cursor: pointer; + display: flex; + align-items: center; + justify-content: space-between; + width: 118%; + text-align: left; +} + +.selectedTypeIcon { + margin-right: 5px; +} + +.dropdownArrow { + margin-left: 5px; +} + +.dropdownList { + margin-top: 11px; + position: absolute; + top: 100%; + left: 0; + background-color: #fff; + border: 1px solid #ccc; + border-radius: 5px; + padding: 5px 0; + list-style: none; + /*margin: 0;*/ + z-index: 1; /* Убедитесь, что список отображается поверх других элементов */ + width: 100%; /* Занимает всю ширину контейнера */ + box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1); +} + +.dropdownItem { + padding: 10px 15px; + cursor: pointer; + display: flex; + align-items: center; +} + +.dropdownItem:hover { + background-color: #f0f0f0; +} + +.dropdownItemIcon { + margin-right: 5px; +} + +.selectedTypeIcon, +.dropdownItemIcon { + width: 20px; /* Задайте нужную ширину и высоту */ + height: 20px; + margin-right: 5px; + vertical-align: middle; /* Выровняйте значок по вертикали */ +} diff --git a/SurveyFrontend/src/components/TypeDropdown/TypeDropdown.tsx b/SurveyFrontend/src/components/TypeDropdown/TypeDropdown.tsx new file mode 100644 index 0000000..fd90765 --- /dev/null +++ b/SurveyFrontend/src/components/TypeDropdown/TypeDropdown.tsx @@ -0,0 +1,87 @@ +import React, { useState, useRef, useEffect } from "react"; + +import styles from './TypeDropdown.module.css' + +const single_selected = '../../../public/radio_button_checked.svg'; +const multiple_selected = '../../../public/check_box.svg'; + + +const TypeDropdown: React.FC = () => { + const [isOpen, setIsOpen] = useState(false); + const [selectedType, setSelectedType] = useState('single'); + const dropdownRef = useRef(null); + + const handleToggle = () =>{ + setIsOpen(!isOpen); + } + + const handleSelect = (value: string) => { + setSelectedType(value); + setIsOpen(false); + } + + useEffect(() => { + const handleClickOutside = (event: MouseEvent) => { + if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) { + setIsOpen(false); + } + }; + + document.addEventListener("mousedown", handleClickOutside); + return () => { + document.removeEventListener("mousedown", handleClickOutside); + }; + }, [dropdownRef]); + + const getImage = (typeValue: string, isSelected: boolean): string => { + if (typeValue === 'multiply') { + return multiple_selected; + } else { + return single_selected; + } + }; + + return ( + + + + {selectedType === "single" ? "Одиночный выбор" : "Множественный выбор"} + ▼ + + + {isOpen && ( + + handleSelect("single")} + > + + Одиночный выбор + + handleSelect("multiply")} + > + + Множественный выбор + + + )} + + ); +}; + +export default TypeDropdown; + diff --git a/SurveyFrontend/src/pages/Questions.tsx b/SurveyFrontend/src/pages/Questions.tsx new file mode 100644 index 0000000..05b713f --- /dev/null +++ b/SurveyFrontend/src/pages/Questions.tsx @@ -0,0 +1,13 @@ +import Header from '../components/Header/Header.tsx' +import MainComponents from '../components/MainComponent/MainComponent.tsx' + +const Questions = () => { + return ( + <> + + + > + ); +}; + +export default Questions; \ No newline at end of file diff --git a/SurveyFrontend/src/pages/Results.tsx b/SurveyFrontend/src/pages/Results.tsx new file mode 100644 index 0000000..e69de29 diff --git a/SurveyFrontend/src/pages/Settings.tsx b/SurveyFrontend/src/pages/Settings.tsx new file mode 100644 index 0000000..e69de29
{descriptionSurvey}
+ +