A photo beside a heading and four figures, on the brand colour.

Last updated

Open block
Show code
---
/**
 * Split image 02brand: A photo beside a heading and four figures, on the brand colour.
 *
 * @block metrics
 * @order 16
 */
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import Image from '@/components/apogee/Image/Image.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { MetricsContent } from '@/components/apogee/sections/_shared/metrics.ts'

/** @composable */
interface Props extends MetricsContent {}

const {
  eyebrow = 'Build better, launch faster',
  heading = 'Build great products, faster than ever',
  description = "Everything you need to build modern interfaces and great products. We've done the heavy lifting, so you can start any project from a solid base.",
  items = [
    { value: '400+', label: 'Projects completed' },
    { value: '600%', label: 'Return on investment' },
    { value: '10k', label: 'Global downloads' },
    { value: '200+', label: 'Five-star reviews' },
  ],
  media = { src: 'https://picsum.photos/seed/apogee-metrics-6/1200/1100', alt: '', width: 1200, height: 1100 },
} = Astro.props
---

<Section spacing="large" background="primary">
  <div class="grid gap-12 lg:grid-cols-2 lg:gap-16">
    <div class="flex flex-col gap-12 self-center">
      <SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} size="large" background="primary" />
      <dl class="grid gap-8 sm:grid-cols-2 sm:gap-y-12">
        {items.map((s) => (
          <div class="flex flex-col gap-3">
            <dt class="order-2 text-lg font-semibold">{s.label}</dt>
            <dd class="order-1 text-5xl font-semibold tracking-tight tabular-nums md:text-6xl ">{s.value}</dd>
          </div>
        ))}
      </dl>
    </div>
    {media && <Image src={media.src} alt={media.alt} width={media.width} height={media.height} fit="cover" radius="xl" class="h-70 w-full md:h-140 lg:order-first" />}
  </div>
</Section>

Add

npx @ava-ui/apogee add metrics/split-image-02-brand

This copies the block to src/components/apogee/blocks/metrics/ with everything it uses: Image, 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.
  • Photos that only decorate have an empty alt; give yours one when it carries meaning.