ifixkart-admin/components/logistics/LogisticsHeaderNav.tsx

68 lines
1.8 KiB
TypeScript

'use client';
import React from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { Truck, Navigation, Settings } from 'lucide-react';
export const LogisticsHeaderNav: React.FC = () => {
const pathname = usePathname();
const tabs = [
{
id: 'delhivery',
name: 'Delhivery One (Trial)',
href: '/delhivery-logistics',
icon: Navigation,
badge: 'Trial Active',
match: pathname === '/delhivery-logistics',
},
{
id: 'shiprocket',
name: 'Shiprocket',
href: '/logistics',
icon: Truck,
match: pathname === '/logistics',
},
{
id: 'settings',
name: 'Logistics Credentials',
href: '/integrations/shipping',
icon: Settings,
match: pathname.startsWith('/integrations/shipping'),
},
];
return (
<div className="flex items-center gap-2 overflow-x-auto pb-1 mb-2">
{tabs.map((tab) => {
const Icon = tab.icon;
const isActive = tab.match;
return (
<Link
key={tab.id}
href={tab.href}
className={`inline-flex items-center gap-2 h-9 px-3.5 crm-radius-control text-[13px] font-semibold whitespace-nowrap transition-colors ${
isActive
? 'bg-primary text-white shadow-sm'
: 'border border-border bg-card text-foreground hover:bg-muted'
}`}
>
<Icon className="w-4 h-4" />
<span>{tab.name}</span>
{tab.badge && (
<span
className={`text-[10px] font-bold px-1.5 py-0.5 rounded ${
isActive ? 'bg-white/20 text-white' : 'bg-amber-500/15 text-amber-600'
}`}
>
{tab.badge}
</span>
)}
</Link>
);
})}
</div>
);
};