edit layout for small resolution screens
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
'use client'
|
||||
|
||||
import { IconBurgerMenu } from '@/app/ui/icons/icons';
|
||||
import { useSideMenuStore } from '@/app/stores/sideMenuStore';
|
||||
|
||||
export default function BurgerMenu() {
|
||||
const setMenuState = useSideMenuStore(s => s.setValue);
|
||||
const menuState = useSideMenuStore(s => s.value);
|
||||
|
||||
function openMenu() {
|
||||
setMenuState(true);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className="header-burger-menu"
|
||||
onClick={() => {
|
||||
openMenu();
|
||||
}}
|
||||
>
|
||||
<IconBurgerMenu />
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { useState, useRef } from 'react';
|
||||
import Link from 'next/link';
|
||||
import clsx from 'clsx';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useSideMenuStore } from '@/app/stores/sideMenuStore';
|
||||
|
||||
export default function DropDownList() {
|
||||
const pathname = usePathname().replace('/en/', '/').replace('/ru/', '/');
|
||||
const [dropDownExpanded, setDropDownExpanded] = useState(false);
|
||||
const t = useTranslations('Global');
|
||||
const setMenuState = useSideMenuStore(s => s.setValue);
|
||||
|
||||
function dropDownHandler() {
|
||||
setDropDownExpanded(!dropDownExpanded);
|
||||
}
|
||||
|
||||
const links = [
|
||||
{
|
||||
name: t('photo-marking'),
|
||||
href: '/pages/marking-photo'
|
||||
},
|
||||
{
|
||||
name: t('video-marking'),
|
||||
href: '/pages/marking-video'
|
||||
},
|
||||
{
|
||||
name: t('audio-marking'),
|
||||
href: '/pages/marking-audio'
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={`nav-dropdown ${dropDownExpanded ? 'expanded' : ''}`}
|
||||
onClick={dropDownHandler}
|
||||
>
|
||||
<div className="flex nav-link cursor-pointer select-none">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2l-5.37.84z"></path>
|
||||
</svg>
|
||||
<p>
|
||||
{t('marking')}
|
||||
</p>
|
||||
<svg className="dropdown-arrow" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M7 10l5 5 5-5z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<ul className={`sub-menu ${dropDownExpanded ? 'expanded' : ''}`}>
|
||||
{links.map((link) => {
|
||||
return (
|
||||
<Link
|
||||
key={link.name}
|
||||
href={link.href}
|
||||
className={clsx(
|
||||
`flex nav-link sub-link`,
|
||||
{
|
||||
'bg-[#5659f1]': pathname === link.href,
|
||||
},
|
||||
)}
|
||||
onClick={() => {
|
||||
setMenuState(false)
|
||||
}}
|
||||
>
|
||||
<p className="">{link.name}</p>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import clsx from 'clsx';
|
||||
import Logo from '@/app/ui/logo';
|
||||
import DropDownList from '@/app/ui/navigation/nav-link-dropdown';
|
||||
import { logout } from '@/app/actions/auth';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import navigation from './navigation.json';
|
||||
import { useSideMenuStore } from '@/app/stores/sideMenuStore';
|
||||
import { useRef } from 'react';
|
||||
import { useClickOutside } from '@/app/hooks/useClickOutside';
|
||||
|
||||
export default function NavLinks() {
|
||||
const pathname = usePathname().replace('/en/', '/').replace('/ru/', '/');
|
||||
const t = useTranslations('Global');
|
||||
|
||||
const setMenuState = useSideMenuStore(s => s.setValue);
|
||||
const menuState = useSideMenuStore(s => s.value);
|
||||
const links = navigation;
|
||||
|
||||
const sideMenuRef = useRef<HTMLDivElement>(null)
|
||||
useClickOutside(
|
||||
sideMenuRef,
|
||||
() => {
|
||||
setMenuState(false);
|
||||
},
|
||||
menuState
|
||||
);
|
||||
|
||||
return (
|
||||
<nav
|
||||
className={`sidebar ${menuState ? 'show' : ''}`}
|
||||
ref={sideMenuRef}
|
||||
>
|
||||
<div className="flex justify-between">
|
||||
<Logo />
|
||||
<button
|
||||
className="sidebar-close-button"
|
||||
onClick={() => {
|
||||
setMenuState(false);
|
||||
}}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z" /></svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<Link
|
||||
key={t('home')}
|
||||
href='/pages/dashboard'
|
||||
className={clsx(
|
||||
"flex nav-link",
|
||||
{
|
||||
'bg-[#5659f1]': pathname === '/pages/dashboard',
|
||||
},
|
||||
)}
|
||||
onClick={() => {
|
||||
setMenuState(false);
|
||||
}}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"></path>
|
||||
</svg>
|
||||
<p className="">{t('home')}</p>
|
||||
</Link>
|
||||
|
||||
<DropDownList />
|
||||
|
||||
{links.map((link) => {
|
||||
return (
|
||||
<Link
|
||||
key={link.name}
|
||||
href={link.href}
|
||||
className={clsx(
|
||||
`flex nav-link`,
|
||||
{
|
||||
'bg-[#5659f1]': pathname === link.href,
|
||||
},
|
||||
)}
|
||||
onClick={() => {
|
||||
setMenuState(false);
|
||||
}}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d={link.img}></path>
|
||||
</svg>
|
||||
<p className="">
|
||||
{t(link.name)}
|
||||
</p>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
<Link
|
||||
key={t('exit')}
|
||||
href='/login'
|
||||
className="flex nav-link"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
setMenuState(false);
|
||||
logout();
|
||||
}}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"></path>
|
||||
</svg>
|
||||
<p className="">{t('exit')}</p>
|
||||
</Link>
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
"name": "reports",
|
||||
"href": "/pages/reports",
|
||||
"img": "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"
|
||||
},
|
||||
{
|
||||
"name": "settings",
|
||||
"href": "/pages/settings",
|
||||
"img": "M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.82,11.69,4.82,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"
|
||||
},
|
||||
{
|
||||
"name": "my-content",
|
||||
"href": "/pages/my-content",
|
||||
"img": "M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1z"
|
||||
},
|
||||
{
|
||||
"name": "referral-program",
|
||||
"href": "/pages/refferals",
|
||||
"img": "M16 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zm4 18v-6h2.5l-2.54-7.63A1.5 1.5 0 0 0 18.54 8H16c-.8 0-1.54.37-2 1l-3 4v2h2l2.54-3.82L16.5 18H20z"
|
||||
},
|
||||
{
|
||||
"name": "violations",
|
||||
"href": "/pages/violations",
|
||||
"img": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
},
|
||||
{
|
||||
"name": "search",
|
||||
"href": "/pages/emptypage",
|
||||
"img": "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
|
||||
},
|
||||
{
|
||||
"name": "API",
|
||||
"href": "/pages/emptypage",
|
||||
"img": "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user