RC-7-home-page #5

Merged
evgeniywas merged 8 commits from RC-7-home-page into dev 2023-08-06 17:46:08 +03:00
5 changed files with 45 additions and 23 deletions
Showing only changes of commit 120ad1b4f7 - Show all commits

View File

@@ -2,9 +2,9 @@ import FuseSuspense from '@fuse/core/FuseSuspense';
import AppContext from 'src/app/contexts/AppContext'; import AppContext from 'src/app/contexts/AppContext';
import { selectFuseCurrentLayoutConfig } from 'app/store/fuse/settingsSlice'; import { selectFuseCurrentLayoutConfig } from 'app/store/fuse/settingsSlice';
import i18next from 'i18next'; import i18next from 'i18next';
import { memo, useContext } from 'react'; import { memo, useContext, useEffect } from 'react';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { useRoutes } from 'react-router-dom'; import { useLocation, useRoutes } from 'react-router-dom';
import { useAuth } from 'src/app/contexts/AuthContext'; import { useAuth } from 'src/app/contexts/AuthContext';
import FooterLayout2 from './components/FooterLayout2'; import FooterLayout2 from './components/FooterLayout2';
import HeaderLayout2 from './components/HeaderLayout2'; import HeaderLayout2 from './components/HeaderLayout2';
@@ -18,6 +18,16 @@ function Layout2(props) {
const authContext = useAuth(); const authContext = useAuth();
const appContext = useContext(AppContext); const appContext = useContext(AppContext);
const { routes } = appContext; const { routes } = appContext;
const location = useLocation();
useEffect(() => {
const { hash } = location;
if (hash) {
const target = document.querySelector(hash);
target.scrollIntoView({ behavior: 'smooth' });
}
}, [location]);
return ( return (
<> <>

View File

@@ -1,7 +1,7 @@
import { memo } from 'react'; import { memo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import linksConfigLayout2 from './linksLayout2Config'; import NavLinks from './NavLinks';
function FooterLayout2() { function FooterLayout2() {
const { t } = useTranslation('layout2'); const { t } = useTranslation('layout2');
@@ -35,14 +35,8 @@ function FooterLayout2() {
</a> </a>
</li> </li>
</ul> </ul>
<ul className="flex flex-col gap-16 mt-96"> <ul className="flex flex-col gap-16 mt-[61px]">
{linksConfigLayout2.map((path) => ( <NavLinks className="text-lg leading-5 text-white no-underline" />
<li key={path}>
<Link className="text-lg leading-5 text-white no-underline" to={`/${path}`}>
{t(path)}
</Link>
</li>
))}
</ul> </ul>
</div> </div>
</footer> </footer>

View File

@@ -2,7 +2,7 @@ import FuseSvgIcon from '@fuse/core/FuseSvgIcon/FuseSvgIcon';
import { memo } from 'react'; import { memo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import linksConfigLayout2 from './linksLayout2Config'; import Links from './NavLinks';
function HeaderLayout2(props) { function HeaderLayout2(props) {
const { t } = useTranslation('layout2'); const { t } = useTranslation('layout2');
@@ -19,15 +19,7 @@ function HeaderLayout2(props) {
</Link> </Link>
<nav className="flex grow justify-center gap-72 items-center"> <nav className="flex grow justify-center gap-72 items-center">
{linksConfigLayout2.map((path) => ( <Links className="text-lg leading-5 text-common-layout no-underline" />
<Link
className="text-lg leading-5 text-common-layout no-underline"
to={`/${path}`}
key={path}
>
{t(path)}
</Link>
))}
</nav> </nav>
{props.isAuthenticated || ( {props.isAuthenticated || (

View File

@@ -0,0 +1,26 @@
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
function NavLinks({ className }) {
const { t } = useTranslation('layout2');
return (
<>
<Link className={className} to="/rent-and-buy">
{t('rent_and_buy')}
</Link>
<Link className={className} to={{ hash: 'about-us' }}>
{t('about_us')}
</Link>
<Link className={className} to={{ hash: 'blog' }}>
{t('blog')}
</Link>
<Link className={className} to={{ hash: 'contacts' }}>
{t('contacts')}
</Link>
</>
);
}
export default memo(NavLinks);

View File

@@ -1,6 +1,6 @@
const locale = { const locale = {
'rent-and-buy': 'Rent&Buy Analysis', rent_and_buy: 'Rent&Buy Analysis',
'about-us': 'About Us', about_us: 'About Us',
blog: 'Blog', blog: 'Blog',
contacts: 'Contacts', contacts: 'Contacts',
sign_in: 'Log In', sign_in: 'Log In',