Files
hats-app/app/(dashboard)/components/Footer.tsx
T
2025-12-19 13:57:55 +07:00

41 lines
1.5 KiB
TypeScript

'use client'
import FOOTER_MENU from '@/lib/data-footer';
import Link from 'next/link';
import { usePathname, useRouter } from 'next/navigation';
import { FC } from 'react';
type Props = {};
const Footer: FC<Props> = () => {
const pathname = usePathname()
const router = useRouter()
const getMenuActiveStyle = (path: string) => {
if (pathname?.startsWith(path) && (pathname !== '' && pathname !== '/') && (path !== '' && path !== '/')) {
return 'text-zinc-950 dark:text-white font-semibold dark:font-medium'
} else {
if (path === pathname) {
return 'text-zinc-950 dark:text-white font-semibold dark:font-medium'
}
}
return ''
}
return (
<footer className="flex sm:hidden flex-col sticky bottom-2.5 z-10 backdrop-blur-lg bg-white/50 dark:bg-zinc-950/50 rounded-2xl mx-6 shadow-sm">
<div className="grid grid-cols-5 p-3 text-[10px] font-medium text-muted-foreground">
{FOOTER_MENU.map((item, key) =>
<Link href={item.path} onClick={() => router.push(item.path)}
className={`flex flex-col items-center space-y-0.5 ${getMenuActiveStyle(item.path)}`} key={key}
>
<i className={`${item.icon} text-xl`}></i>
<p>{item.title}</p>
</Link>
)}
</div>
</footer>
);
}
export default Footer;