diff --git a/SurveyFrontend/src/components/MainComponent/MainComponent.tsx b/SurveyFrontend/src/components/MainComponent/MainComponent.tsx index c5d5cc9..695dbf5 100644 --- a/SurveyFrontend/src/components/MainComponent/MainComponent.tsx +++ b/SurveyFrontend/src/components/MainComponent/MainComponent.tsx @@ -5,10 +5,13 @@ import Survey from "../Survey/Survey.tsx"; import SettingSurvey from "../SettingSurvey/SettingSurvey.tsx"; const MainComponent: React.FC = () => { - const [activePage, setActivePage] = useState('Вопросы'); + const [activePage, setActivePage] = useState( + localStorage.getItem("activePage") || "Вопросы" + ); const handleNavigationClick = (title: string) => { setActivePage(title); + localStorage.setItem('activePage', title); } return ( diff --git a/SurveyFrontend/src/components/TimeEvent/TimeEvent.module.css b/SurveyFrontend/src/components/TimeEvent/TimeEvent.module.css index 107d917..4417f66 100644 --- a/SurveyFrontend/src/components/TimeEvent/TimeEvent.module.css +++ b/SurveyFrontend/src/components/TimeEvent/TimeEvent.module.css @@ -34,4 +34,4 @@ font-size: 20px; /*??????????????????????? в макете указано bodyLarge/Size*/ font-weight: 400; border-radius: 3px; -} \ No newline at end of file +} diff --git a/SurveyFrontend/src/components/TimeEvent/TimeEvent.tsx b/SurveyFrontend/src/components/TimeEvent/TimeEvent.tsx index 9c07a6a..4b8c810 100644 --- a/SurveyFrontend/src/components/TimeEvent/TimeEvent.tsx +++ b/SurveyFrontend/src/components/TimeEvent/TimeEvent.tsx @@ -1,29 +1,41 @@ -import React from 'react'; -import { format } from "@formkit/tempo"; +import React, { useState } from 'react'; import styles from "./TimeEvent.module.css"; - interface TimeEventProps { title: string; - } -const TimeEvent: React.FC = ({title}) => { - const date = new Date(); +const TimeEvent: React.FC = ({ title }) => { + const [date, setDate] = useState(() => { + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + const day = String(now.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; + }); + + const [time, setTime] = useState(() => { + const now = new Date(); + const hours = String(now.getHours()).padStart(2, '0'); + const minutes = String(now.getMinutes()).padStart(2, '0'); + return `${hours}:${minutes}`; + }); return (

{title}

setDate(e.target.value)} /> setTime(e.target.value)} />