| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import { cn } from '@/lib/utils';
- import type { NewsletterSection } from '../types';
- import { Container } from '../ui';
-
- export function Newsletter({ section }: { section: NewsletterSection }) {
- const { heading, body, placeholder, buttonLabel } = section.content;
- const card = section.variant === 'card';
-
- return (
- <section
- id={section.id}
- className={cn(
- 'scroll-mt-20',
- card ? 'py-16' : 'bg-(--sf-primary) text-(--sf-primary-fg)',
- )}
- >
- <Container
- className={cn(
- 'flex flex-col gap-6 md:flex-row md:items-center md:justify-between',
- card
- ? 'max-w-4xl rounded-(--sf-radius-card) bg-(--sf-primary) p-8 text-(--sf-primary-fg) sm:p-10'
- : 'py-12',
- )}
- >
- <div className="max-w-md">
- <h2 className="sf-heading text-2xl font-semibold sm:text-3xl">
- {heading}
- </h2>
- {body && <p className="mt-2 opacity-85">{body}</p>}
- </div>
-
- {/* Sign-ups are not saved yet. That arrives with the commerce step. */}
- <form
- className="flex w-full max-w-md gap-2"
- onSubmit={(event) => event.preventDefault()}
- >
- <label className="sr-only" htmlFor={`${section.id}-email`}>
- {placeholder}
- </label>
- <input
- id={`${section.id}-email`}
- type="email"
- placeholder={placeholder}
- 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)"
- />
- <button
- type="submit"
- 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"
- >
- {buttonLabel}
- </button>
- </form>
- </Container>
- </section>
- );
- }
|