2025-12-09 16:35:47 +07:00
|
|
|
import { useState, useRef } from 'react';
|
2025-11-25 19:20:50 +07:00
|
|
|
import Link from 'next/link';
|
|
|
|
|
import clsx from 'clsx';
|
|
|
|
|
import { usePathname } from 'next/navigation';
|
2025-12-12 11:00:23 +07:00
|
|
|
import { useTranslations } from 'next-intl';
|
2026-01-23 15:43:05 +07:00
|
|
|
import { useSideMenuStore } from '@/app/stores/sideMenuStore';
|
2025-11-25 19:20:50 +07:00
|
|
|
|
|
|
|
|
export default function DropDownList() {
|
2025-12-17 09:18:18 +07:00
|
|
|
const pathname = usePathname().replace('/en/', '/').replace('/ru/', '/');
|
2025-11-25 19:20:50 +07:00
|
|
|
const [dropDownExpanded, setDropDownExpanded] = useState(false);
|
2025-12-12 11:00:23 +07:00
|
|
|
const t = useTranslations('Global');
|
2026-01-23 15:43:05 +07:00
|
|
|
const setMenuState = useSideMenuStore(s => s.setValue);
|
2025-11-25 19:20:50 +07:00
|
|
|
|
|
|
|
|
function dropDownHandler() {
|
|
|
|
|
setDropDownExpanded(!dropDownExpanded);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const links = [
|
|
|
|
|
{
|
2025-12-12 11:00:23 +07:00
|
|
|
name: t('photo-marking'),
|
2026-01-26 13:26:21 +07:00
|
|
|
href: '/pages/marking-images'
|
2025-11-25 19:20:50 +07:00
|
|
|
},
|
|
|
|
|
{
|
2025-12-12 11:00:23 +07:00
|
|
|
name: t('video-marking'),
|
2025-12-09 16:35:47 +07:00
|
|
|
href: '/pages/marking-video'
|
2025-11-25 19:20:50 +07:00
|
|
|
},
|
|
|
|
|
{
|
2025-12-12 11:00:23 +07:00
|
|
|
name: t('audio-marking'),
|
2025-12-09 16:35:47 +07:00
|
|
|
href: '/pages/marking-audio'
|
|
|
|
|
}
|
2025-11-25 19:20:50 +07:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return (
|
2025-12-09 16:35:47 +07:00
|
|
|
<>
|
|
|
|
|
<div
|
2025-12-27 11:54:54 +07:00
|
|
|
className={`nav-dropdown ${dropDownExpanded ? 'expanded' : ''}`}
|
2025-12-09 16:35:47 +07:00
|
|
|
onClick={dropDownHandler}
|
|
|
|
|
>
|
2025-12-27 11:54:54 +07:00
|
|
|
<div className="flex nav-link cursor-pointer select-none">
|
2025-12-09 16:35:47 +07:00
|
|
|
<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>
|
2025-12-12 11:00:23 +07:00
|
|
|
<p>
|
|
|
|
|
{t('marking')}
|
|
|
|
|
</p>
|
2025-12-27 11:54:54 +07:00
|
|
|
<svg className="dropdown-arrow" viewBox="0 0 24 24" fill="currentColor">
|
2025-12-09 16:35:47 +07:00
|
|
|
<path d="M7 10l5 5 5-5z"></path>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
2025-11-25 19:20:50 +07:00
|
|
|
</div>
|
2025-12-27 11:54:54 +07:00
|
|
|
<ul className={`sub-menu ${dropDownExpanded ? 'expanded' : ''}`}>
|
2025-11-25 19:20:50 +07:00
|
|
|
{links.map((link) => {
|
|
|
|
|
return (
|
|
|
|
|
<Link
|
|
|
|
|
key={link.name}
|
|
|
|
|
href={link.href}
|
|
|
|
|
className={clsx(
|
2025-12-27 11:54:54 +07:00
|
|
|
`flex nav-link sub-link`,
|
2025-11-25 19:20:50 +07:00
|
|
|
{
|
|
|
|
|
'bg-[#5659f1]': pathname === link.href,
|
|
|
|
|
},
|
|
|
|
|
)}
|
2026-01-23 15:43:05 +07:00
|
|
|
onClick={() => {
|
|
|
|
|
setMenuState(false)
|
|
|
|
|
}}
|
2025-11-25 19:20:50 +07:00
|
|
|
>
|
2026-01-08 11:16:59 +07:00
|
|
|
<p className="">{link.name}</p>
|
2025-11-25 19:20:50 +07:00
|
|
|
</Link>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</ul>
|
2025-12-09 16:35:47 +07:00
|
|
|
</>
|
2025-11-25 19:20:50 +07:00
|
|
|
)
|
|
|
|
|
}
|