AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

store-nav.tsx 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { Link } from '@inertiajs/react';
  2. import OrderController from '@/actions/App/Http/Controllers/OrderController';
  3. import ProductController from '@/actions/App/Http/Controllers/ProductController';
  4. import StoreController from '@/actions/App/Http/Controllers/StoreController';
  5. import { cn } from '@/lib/utils';
  6. type Tab = 'design' | 'products' | 'orders';
  7. /** The tabs at the top of every page of one store. */
  8. export default function StoreNav({
  9. slug,
  10. current,
  11. }: {
  12. slug: string;
  13. current: Tab;
  14. }) {
  15. const tabs: { key: Tab; label: string; href: string }[] = [
  16. {
  17. key: 'design',
  18. label: 'Design',
  19. href: StoreController.show.url(slug),
  20. },
  21. {
  22. key: 'products',
  23. label: 'Products',
  24. href: ProductController.index.url(slug),
  25. },
  26. {
  27. key: 'orders',
  28. label: 'Orders',
  29. href: OrderController.index.url(slug),
  30. },
  31. ];
  32. return (
  33. <nav aria-label="Store" className="flex gap-1 border-b">
  34. {tabs.map((tab) => (
  35. <Link
  36. key={tab.key}
  37. href={tab.href}
  38. aria-current={tab.key === current ? 'page' : undefined}
  39. className={cn(
  40. '-mb-px border-b-2 px-3 py-2 text-sm font-medium transition-colors',
  41. tab.key === current
  42. ? 'border-foreground text-foreground'
  43. : 'border-transparent text-muted-foreground hover:text-foreground',
  44. )}
  45. >
  46. {tab.label}
  47. </Link>
  48. ))}
  49. </nav>
  50. );
  51. }