AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

layout.tsx 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { Link } from '@inertiajs/react';
  2. import type { PropsWithChildren } from 'react';
  3. import Heading from '@/components/heading';
  4. import { Button } from '@/components/ui/button';
  5. import { Separator } from '@/components/ui/separator';
  6. import { useCurrentUrl } from '@/hooks/use-current-url';
  7. import { cn, toUrl } from '@/lib/utils';
  8. import { edit as editAppearance } from '@/routes/appearance';
  9. import { edit } from '@/routes/profile';
  10. import { edit as editSecurity } from '@/routes/security';
  11. import type { NavItem } from '@/types';
  12. const sidebarNavItems: NavItem[] = [
  13. {
  14. title: 'Profile',
  15. href: edit(),
  16. icon: null,
  17. },
  18. {
  19. title: 'Security',
  20. href: editSecurity(),
  21. icon: null,
  22. },
  23. {
  24. title: 'Appearance',
  25. href: editAppearance(),
  26. icon: null,
  27. },
  28. ];
  29. export default function SettingsLayout({ children }: PropsWithChildren) {
  30. const { isCurrentOrParentUrl } = useCurrentUrl();
  31. return (
  32. <div className="px-4 py-6">
  33. <Heading
  34. title="Settings"
  35. description="Manage your profile and account settings"
  36. />
  37. <div className="flex flex-col lg:flex-row lg:space-x-12">
  38. <aside className="w-full max-w-xl lg:w-48">
  39. <nav
  40. className="flex flex-col space-y-1 space-x-0"
  41. aria-label="Settings"
  42. >
  43. {sidebarNavItems.map((item, index) => (
  44. <Button
  45. key={`${toUrl(item.href)}-${index}`}
  46. size="sm"
  47. variant="ghost"
  48. asChild
  49. className={cn('w-full justify-start', {
  50. 'bg-muted': isCurrentOrParentUrl(item.href),
  51. })}
  52. >
  53. <Link href={item.href}>
  54. {item.icon && (
  55. <item.icon className="h-4 w-4" />
  56. )}
  57. {item.title}
  58. </Link>
  59. </Button>
  60. ))}
  61. </nav>
  62. </aside>
  63. <Separator className="my-6 lg:hidden" />
  64. <div className="flex-1 md:max-w-2xl">
  65. <section className="max-w-xl space-y-12">
  66. {children}
  67. </section>
  68. </div>
  69. </div>
  70. </div>
  71. );
  72. }