A heading, three benefits and an email signup beside a screen that runs off the edge.

Last updated

Open block
Show code
---
/**
 * Screen mockup 01: A heading, three benefits and an email signup beside a screen that runs off the edge.
 *
 * @block newsletter
 * @order 13
 */
import { CircleCheck } from '@lucide/astro'
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import Button from '@/components/apogee/Button/Button.astro'
import Input from '@/components/apogee/Input/Input.astro'
import Link from '@/components/apogee/Link/Link.astro'
import DeviceFrame from '@/components/apogee/DeviceFrame/DeviceFrame.astro'
import List from '@/components/apogee/List/List.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { NewsletterContent } from '@/components/apogee/sections/_shared/newsletter.ts'

/** @composable */
interface Props extends NewsletterContent {
  /** The checked lines under the description. @category content */
  features?: string[] | null
}

const {
  eyebrow,
  heading = 'We\'ll send you a nice letter once a week',
  description = 'No spam. Just the latest releases and tips, interesting articles and interviews with great people.',
  submitLabel = 'Subscribe',
  features = ['Latest releases and tips', 'Our favourite articles each week', 'Interviews with people worth hearing from'],
  media = { src: '/mockups/app-desktop-light.jpg', srcDark: '/mockups/app-desktop-dark.jpg', alt: 'The dashboard overview in a browser' },
} = Astro.props
---

<Section spacing="large" class="overflow-hidden">
  <div class="grid items-center gap-12 lg:grid-cols-2 lg:gap-16">
    <div class="flex flex-col items-start gap-8 md:gap-12">
      <SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} size="large" />
      {features && (
      <List marker="none" class="flex flex-col gap-4 space-y-0">
        {features.map((feature) => <li class="flex gap-3"><CircleCheck class="size-6 shrink-0 text-primary" aria-hidden="true" />{feature}</li>)}
      </List>
      )}
      <form method="post" class="flex w-full max-w-md flex-col gap-2">
      <div class="flex flex-col gap-3 md:flex-row">
        <Input type="email" name="email" placeholder="Enter your email" aria-label="Email" autocomplete="email" required size="large" class="flex-1 text-start" />
        <Button type="submit" size="large">{submitLabel}</Button>
      </div>
      <p class="text-sm text-neutral-faded">We care about your data in our <Link href="#" color="neutral">privacy policy</Link>.</p>
    </form>
    </div>
    {media && (
    <div class="lg:-me-[max(2rem,calc((100vw-80rem)/2+2rem))] lg:overflow-hidden">
      <DeviceFrame device="browser" src={media.src} srcDark={media.srcDark} alt={media.alt} width={media.width} height={media.height} class="lg:w-[48rem]" />
    </div>
    )}
  </div>
</Section>

Add

npx @ava-ui/apogee add newsletter/screen-mockup-01

This copies the block to src/components/apogee/blocks/newsletter/ with everything it uses: Button, DeviceFrame, Input, Link, List, Section, SectionHeader. Every piece of copy is a prop, with the sample copy as its default. Pass yours, or null to hide a part; see copy is props.

Accessibility

  • The heading is an h2 by default, so the block slots into a page under its h1; item titles are one level down.
  • The email field is named “Email” (the placeholder is not a label); the form submits without JS.