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 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { Link } from '@inertiajs/react';
  2. import type { LucideIcon } from 'lucide-react';
  3. import {
  4. Package,
  5. Palette,
  6. ReceiptText,
  7. Settings,
  8. TicketPercent,
  9. } from 'lucide-react';
  10. import DiscountCodeController from '@/actions/App/Http/Controllers/DiscountCodeController';
  11. import OrderController from '@/actions/App/Http/Controllers/OrderController';
  12. import ProductController from '@/actions/App/Http/Controllers/ProductController';
  13. import StoreController from '@/actions/App/Http/Controllers/StoreController';
  14. import StoreSettingsController from '@/actions/App/Http/Controllers/StoreSettingsController';
  15. import {
  16. TabLabel,
  17. tabClass,
  18. tabRowClass,
  19. } from '@/components/stores/section-tabs';
  20. type Tab = 'design' | 'products' | 'orders' | 'discounts' | 'settings';
  21. /** The tabs at the top of every page of one store. */
  22. export default function StoreNav({
  23. slug,
  24. current,
  25. }: {
  26. slug: string;
  27. current: Tab;
  28. }) {
  29. const tabs: { key: Tab; label: string; icon: LucideIcon; href: string }[] =
  30. [
  31. {
  32. key: 'design',
  33. icon: Palette,
  34. label: 'Design',
  35. href: StoreController.show.url(slug),
  36. },
  37. {
  38. key: 'products',
  39. icon: Package,
  40. label: 'Products',
  41. href: ProductController.index.url(slug),
  42. },
  43. {
  44. key: 'orders',
  45. icon: ReceiptText,
  46. label: 'Orders',
  47. href: OrderController.index.url(slug),
  48. },
  49. {
  50. key: 'discounts',
  51. icon: TicketPercent,
  52. label: 'Discounts',
  53. href: DiscountCodeController.index.url(slug),
  54. },
  55. {
  56. key: 'settings',
  57. icon: Settings,
  58. label: 'Settings',
  59. href: StoreSettingsController.edit.url(slug),
  60. },
  61. ];
  62. return (
  63. <nav aria-label="Store" className={tabRowClass}>
  64. {tabs.map((tab) => (
  65. <Link
  66. key={tab.key}
  67. href={tab.href}
  68. aria-current={tab.key === current ? 'page' : undefined}
  69. className={tabClass(tab.key === current)}
  70. >
  71. <TabLabel
  72. icon={tab.icon}
  73. label={tab.label}
  74. selected={tab.key === current}
  75. />
  76. </Link>
  77. ))}
  78. </nav>
  79. );
  80. }