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.9KB

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