| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import { Link } from '@inertiajs/react';
- import type { LucideIcon } from 'lucide-react';
- import {
- Package,
- Palette,
- ReceiptText,
- Settings,
- TicketPercent,
- } from 'lucide-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 {
- TabLabel,
- tabClass,
- tabRowClass,
- } from '@/components/stores/section-tabs';
-
- 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; icon: LucideIcon; href: string }[] =
- [
- {
- key: 'design',
- icon: Palette,
- label: 'Design',
- href: StoreController.show.url(slug),
- },
- {
- key: 'products',
- icon: Package,
- label: 'Products',
- href: ProductController.index.url(slug),
- },
- {
- key: 'orders',
- icon: ReceiptText,
- label: 'Orders',
- href: OrderController.index.url(slug),
- },
- {
- key: 'discounts',
- icon: TicketPercent,
- label: 'Discounts',
- href: DiscountCodeController.index.url(slug),
- },
- {
- key: 'settings',
- icon: Settings,
- label: 'Settings',
- href: StoreSettingsController.edit.url(slug),
- },
- ];
-
- return (
- <nav aria-label="Store" className={tabRowClass}>
- {tabs.map((tab) => (
- <Link
- key={tab.key}
- href={tab.href}
- aria-current={tab.key === current ? 'page' : undefined}
- className={tabClass(tab.key === current)}
- >
- <TabLabel
- icon={tab.icon}
- label={tab.label}
- selected={tab.key === current}
- />
- </Link>
- ))}
- </nav>
- );
- }
|