A heading, two buttons and a rating beside a phone, with notifications beside it.

Last updated

Open block
Show code
---
/**
 * iPhone mockup 04: A heading, two buttons and a rating beside a phone, with notifications beside it.
 *
 * @block hero
 * @order 24
 */
import { CirclePlay } from '@lucide/astro'
import Section from '@/components/apogee/Section/Section.astro'
import Container from '@/components/apogee/Container/Container.astro'
import Heading from '@/components/apogee/Heading/Heading.astro'
import Button from '@/components/apogee/Button/Button.astro'
import DeviceFrame from '@/components/apogee/DeviceFrame/DeviceFrame.astro'
import AvatarGroup from '@/components/apogee/AvatarGroup/AvatarGroup.astro'
import Avatar from '@/components/apogee/Avatar/Avatar.astro'
import Rating from '@/components/apogee/Rating/Rating.astro'
import { plain, type HeroContent } from '@/components/apogee/sections/_shared/spine.ts'

/** @composable */
interface Props extends HeroContent {
  /** The line under the stars. @category content */
  reviews?: string | null
}

const {
  heading = 'Growth tracking made easy',
  description = 'Powerful, self-serve product and growth analytics to help you convert, engage and retain more users. Trusted by over 4,000 startups.',
  primaryAction = { label: 'Sign up', href: '#' },
  secondaryAction = { label: 'Demo', href: '#' },
  reviews = 'from 200+ reviews',
} = Astro.props
---

<Section spacing="large" container={false} class="overflow-hidden">
  <div class="pointer-events-none absolute inset-0 mask-[radial-gradient(ellipse_at_top,black,transparent_70%)] bg-[radial-gradient(var(--border-neutral)_1px,transparent_1px)] bg-size-[1.5rem_1.5rem]" aria-hidden="true"></div>
  <Container class="relative">
    <div class="grid items-center gap-12 lg:gap-16 lg:grid-cols-2">
    <div class="flex flex-col gap-8 md:gap-12">
      <div class="flex flex-col gap-4 md:gap-6 items-start">
      
      <Heading as="h1" size="display" class="text-balance">{plain(heading)}</Heading>
      {description && <p class="max-w-2xl text-lg md:text-xl text-neutral-faded">{description}</p>}
    </div>
      {(primaryAction || secondaryAction) && (
      <div class="flex flex-col-reverse gap-3 sm:flex-row ">
      {secondaryAction && <Button href={secondaryAction.href} size="large" variant="outline" color="neutral"><CirclePlay slot="start" aria-hidden="true" />{secondaryAction.label}</Button>}
      {primaryAction && <Button href={primaryAction.href} size="large">{primaryAction.label}</Button>}
    </div>
      )}
      <div class="flex items-center gap-4">
      <AvatarGroup items={[{ name: 'Ada Lovelace' }, { name: 'Alan Turing' }, { name: 'Grace Hopper' }, { name: 'Katherine Johnson' }, { name: 'Margaret Hamilton' }]} size="medium" />
      <div class="flex flex-col gap-1">
        <div class="flex items-center gap-2"><Rating value={5} readonly size="small" color="warning" aria-label="Rated 5 out of 5" /><span class="font-semibold">5.0</span></div>
        {reviews && <p class="text-sm text-neutral-faded">{reviews}</p>}
      </div>
    </div>
    </div>
    <div class="flex items-center justify-center gap-6"><ul class="flex list-none flex-col gap-3 p-0 max-lg:hidden" aria-hidden="true">
        {[['Ada Lovelace', '2 min ago'], ['Alan Turing', '8 min ago'], ['Grace Hopper', '1 hr ago']].map(([n, t]) => (
          <li class="flex w-64 items-center gap-3 rounded-xl bg-elevation-raised p-3 shadow-raised ring-1 ring-neutral">
            <Avatar name={n} size="small" />
            <span class="flex flex-col text-sm"><span><span class="font-semibold">{n}</span> followed you</span><span class="text-neutral-faded">{t}</span></span>
          </li>
        ))}
      </ul><div class="relative flex justify-center ">
      <span class="absolute inset-x-0 top-1/2 mx-auto aspect-square w-full max-w-md -translate-y-1/2 rounded-full bg-neutral-faded" aria-hidden="true"></span>
      <DeviceFrame device="phone" src="/mockups/app-phone-light.jpg" srcDark="/mockups/app-phone-dark.jpg" alt="The dashboard overview on a phone" class="relative w-60 md:w-64" />
    </div></div>
  </div>
  </Container>
</Section>

Add

npx @ava-ui/apogee add hero/iphone-mockup-04

This copies the block to src/components/apogee/blocks/hero/ with everything it uses: Avatar, AvatarGroup, Button, Container, DeviceFrame, Heading, Rating, Section. 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 the page’s h1; the items below are one level down.
  • The stars are read as one rating (“Rated 5 out of 5”).