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.

newsletter.tsx 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { cn } from '@/lib/utils';
  2. import type { NewsletterSection } from '../types';
  3. import { Container } from '../ui';
  4. export function Newsletter({ section }: { section: NewsletterSection }) {
  5. const { heading, body, placeholder, buttonLabel } = section.content;
  6. const card = section.variant === 'card';
  7. return (
  8. <section
  9. id={section.id}
  10. className={cn(
  11. 'scroll-mt-20',
  12. card ? 'py-16' : 'bg-(--sf-primary) text-(--sf-primary-fg)',
  13. )}
  14. >
  15. <Container
  16. className={cn(
  17. 'flex flex-col gap-6 md:flex-row md:items-center md:justify-between',
  18. card
  19. ? 'max-w-4xl rounded-(--sf-radius-card) bg-(--sf-primary) p-8 text-(--sf-primary-fg) sm:p-10'
  20. : 'py-12',
  21. )}
  22. >
  23. <div className="max-w-md">
  24. <h2 className="sf-heading text-2xl font-semibold sm:text-3xl">
  25. {heading}
  26. </h2>
  27. {body && <p className="mt-2 opacity-85">{body}</p>}
  28. </div>
  29. {/* Sign-ups are not saved yet. That arrives with the commerce step. */}
  30. <form
  31. className="flex w-full max-w-md gap-2"
  32. onSubmit={(event) => event.preventDefault()}
  33. >
  34. <label className="sr-only" htmlFor={`${section.id}-email`}>
  35. {placeholder}
  36. </label>
  37. <input
  38. id={`${section.id}-email`}
  39. type="email"
  40. placeholder={placeholder}
  41. className="min-w-0 flex-1 rounded-(--sf-radius) border border-(--sf-primary-fg)/30 bg-(--sf-primary-fg)/10 px-4 py-2.5 text-sm placeholder:text-(--sf-primary-fg)/65 focus-visible:outline-2 focus-visible:outline-(--sf-primary-fg)"
  42. />
  43. <button
  44. type="submit"
  45. className="rounded-(--sf-radius) bg-(--sf-primary-fg) px-5 py-2.5 text-sm font-semibold text-(--sf-primary) transition-opacity hover:opacity-90"
  46. >
  47. {buttonLabel}
  48. </button>
  49. </form>
  50. </Container>
  51. </section>
  52. );
  53. }