AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import type { ReactNode } from 'react';
  2. import { cn } from '@/lib/utils';
  3. import { useHref } from './context';
  4. /** Page-width wrapper used by every section. */
  5. export function Container({
  6. className,
  7. children,
  8. }: {
  9. className?: string;
  10. children: ReactNode;
  11. }) {
  12. return (
  13. <div className={cn('mx-auto w-full max-w-6xl px-5 sm:px-8', className)}>
  14. {children}
  15. </div>
  16. );
  17. }
  18. export function SfButton({
  19. href,
  20. variant = 'primary',
  21. className,
  22. children,
  23. }: {
  24. href: string;
  25. variant?: 'primary' | 'outline';
  26. className?: string;
  27. children: ReactNode;
  28. }) {
  29. const resolved = useHref(href);
  30. return (
  31. <a
  32. href={resolved}
  33. className={cn(
  34. 'inline-flex items-center justify-center rounded-(--sf-radius) px-5 py-2.5 text-sm font-semibold transition-opacity hover:opacity-85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--sf-primary)',
  35. variant === 'primary'
  36. ? 'bg-(--sf-primary) text-(--sf-primary-fg)'
  37. : 'border border-(--sf-border) text-(--sf-fg)',
  38. className,
  39. )}
  40. >
  41. {children}
  42. </a>
  43. );
  44. }
  45. /** A plain link whose address is worked out the same way as buttons. */
  46. export function SfLink({
  47. href,
  48. className,
  49. children,
  50. }: {
  51. href: string;
  52. className?: string;
  53. children: ReactNode;
  54. }) {
  55. return (
  56. <a href={useHref(href)} className={className}>
  57. {children}
  58. </a>
  59. );
  60. }
  61. export function Eyebrow({ children }: { children: ReactNode }) {
  62. return (
  63. <p className="text-xs font-semibold tracking-[0.18em] text-(--sf-primary) uppercase">
  64. {children}
  65. </p>
  66. );
  67. }
  68. export function SectionHeading({
  69. heading,
  70. subheading,
  71. align = 'left',
  72. }: {
  73. heading: string;
  74. subheading?: string | null;
  75. align?: 'left' | 'center';
  76. }) {
  77. return (
  78. <div
  79. className={cn(
  80. 'max-w-2xl',
  81. align === 'center' && 'mx-auto text-center',
  82. )}
  83. >
  84. <h2 className="sf-heading text-3xl leading-tight font-semibold sm:text-4xl">
  85. {heading}
  86. </h2>
  87. {subheading && (
  88. <p className="mt-3 text-base text-(--sf-muted)">{subheading}</p>
  89. )}
  90. </div>
  91. );
  92. }
  93. const tilts = ['135deg', '200deg', '45deg', '310deg'];
  94. /**
  95. * Stands in for a photo when there is no real one.
  96. * It is drawn from the theme colours so it always matches the store.
  97. */
  98. export function ImagePlaceholder({
  99. seed = 0,
  100. label,
  101. className,
  102. }: {
  103. seed?: number;
  104. label?: string;
  105. className?: string;
  106. }) {
  107. const tilt = tilts[seed % tilts.length];
  108. return (
  109. <div
  110. role="img"
  111. aria-label={
  112. label ? `Placeholder image: ${label}` : 'Placeholder image'
  113. }
  114. className={cn(
  115. 'relative overflow-hidden rounded-(--sf-radius-card) border border-(--sf-border)',
  116. className,
  117. )}
  118. style={{
  119. background: `linear-gradient(${tilt}, color-mix(in srgb, var(--sf-primary) 28%, var(--sf-surface)), color-mix(in srgb, var(--sf-accent) 38%, var(--sf-surface)))`,
  120. }}
  121. >
  122. <div
  123. className="absolute -right-[15%] -bottom-[25%] aspect-square w-[70%] rounded-full opacity-40"
  124. style={{ background: 'var(--sf-accent)' }}
  125. />
  126. <div
  127. className="absolute -top-[20%] -left-[10%] aspect-square w-[45%] rounded-full opacity-25"
  128. style={{ background: 'var(--sf-primary)' }}
  129. />
  130. </div>
  131. );
  132. }