| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import { Link } from '@inertiajs/react';
- import DiscountCodeController from '@/actions/App/Http/Controllers/DiscountCodeController';
- import OrderController from '@/actions/App/Http/Controllers/OrderController';
- import ProductController from '@/actions/App/Http/Controllers/ProductController';
- import StoreController from '@/actions/App/Http/Controllers/StoreController';
- import StoreSettingsController from '@/actions/App/Http/Controllers/StoreSettingsController';
- import { cn } from '@/lib/utils';
-
- type Tab = 'design' | 'products' | 'orders' | 'discounts' | 'settings';
-
- /** The tabs at the top of every page of one store. */
- export default function StoreNav({
- slug,
- current,
- }: {
- slug: string;
- current: Tab;
- }) {
- const tabs: { key: Tab; label: string; href: string }[] = [
- {
- key: 'design',
- label: 'Design',
- href: StoreController.show.url(slug),
- },
- {
- key: 'products',
- label: 'Products',
- href: ProductController.index.url(slug),
- },
- {
- key: 'orders',
- label: 'Orders',
- href: OrderController.index.url(slug),
- },
- {
- key: 'discounts',
- label: 'Discounts',
- href: DiscountCodeController.index.url(slug),
- },
- {
- key: 'settings',
- label: 'Settings',
- href: StoreSettingsController.edit.url(slug),
- },
- ];
-
- return (
- <nav aria-label="Store" className="flex gap-1 border-b">
- {tabs.map((tab) => (
- <Link
- key={tab.key}
- href={tab.href}
- aria-current={tab.key === current ? 'page' : undefined}
- className={cn(
- '-mb-px border-b-2 px-3 py-2 text-sm font-medium transition-colors',
- tab.key === current
- ? 'border-foreground text-foreground'
- : 'border-transparent text-muted-foreground hover:text-foreground',
- )}
- >
- {tab.label}
- </Link>
- ))}
- </nav>
- );
- }
|