correction of working capacity

This commit is contained in:
Tatiana Nikolaeva 2025-05-14 17:59:36 +05:00
parent bc293f6370
commit fa5fe30c34
11 changed files with 180 additions and 82 deletions

View file

@ -2,19 +2,24 @@ import React from "react";
import Logo from "../Logo/Logo.tsx";
import Account from "../Account/Account.tsx";
import styles from './Header.module.css'
import {Link, useLocation} from "react-router-dom";
import {Link, useLocation, useNavigate} from "react-router-dom";
const Header: React.FC = () => {
const location = useLocation();
const navigate = useNavigate();
const isCreateSurveyActive = location.pathname.includes('/survey/create');
const isSurveyPage = location.pathname.includes('/survey/') && !location.pathname.includes('/survey/create');
const isMySurveysPage = location.pathname === '/my-surveys' || isSurveyPage;
const handleLogoClick = () => {
navigate(location.pathname, { replace: true });
};
return (
<div className={styles.header}>
<Logo href='/' />
<Logo href={location.pathname} onClick={handleLogoClick} />
<nav className={styles.pagesNav}>
<Link to='/survey/create/questions'
className={`${styles.pageLink} ${isCreateSurveyActive ? styles.active : ''}`}>
@ -27,10 +32,7 @@ const Header: React.FC = () => {
{isMySurveysPage && <hr className={styles.activeLine}/>}
</Link>
</nav>
<Account
href='/profile'
user='Иванов Иван'
/>
<Account href={'/profile'} user={'Иванов Иван'}/>
</div>
);
};