A case study: heading, body text and two buttons beside a portrait with a name, role and rating.

Last updated

Open block
Show code
---
/**
 * Section split image 02: A case study: heading, body text and two buttons beside a portrait with a name, role and rating.
 *
 * @block content
 * @order 14
 */
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import Prose from '@/components/apogee/Prose/Prose.astro'
import Image from '@/components/apogee/Image/Image.astro'
import Button from '@/components/apogee/Button/Button.astro'
import Rating from '@/components/apogee/Rating/Rating.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { ContentContent } from '@/components/apogee/sections/_shared/content.ts'

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

const {
  eyebrow = 'Case study',
  heading = 'How we helped a growing studio ship faster',
  description = 'A design system in eight weeks, built from the screens they already had.',
  primaryAction = { label: 'Read case study', href: '#' },
  secondaryAction = { label: 'Chat to us', href: '#' },
  media = { src: 'https://picsum.photos/seed/apogee-content-42/1200/1400', alt: '', width: 1200, height: 1400 },
  author = { name: 'Margaret Hamilton', role: 'Head of Design, Oakmere' },
} = Astro.props
---

<Section spacing="large">
  <div class="grid items-center gap-12 lg:grid-cols-2 lg:gap-16">
    <div class="flex flex-col gap-8">
      <SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} />
      <Prose>
        <h3>The challenge</h3>
        <p>Three products, three button styles and a review queue that grew every sprint.</p>
      </Prose>
      {(primaryAction || secondaryAction) && (
      <div class="flex flex-col-reverse gap-3 sm:flex-row">
        {secondaryAction && <Button href={secondaryAction.href} variant="outline" color="neutral" size="large">{secondaryAction.label}</Button>}
        {primaryAction && <Button href={primaryAction.href} size="large">{primaryAction.label}</Button>}
      </div>
      )}
    </div>
    {media && (
    <figure class="relative m-0 overflow-hidden rounded-2xl">
      <Image src={media.src} alt={media.alt} width={media.width} height={media.height} fit="cover" class="aspect-[6/7] w-full" />
      <figcaption class="absolute inset-x-0 bottom-0 flex items-end justify-between gap-4 bg-inverted/40 p-6 text-on-inverted backdrop-blur-md">
        {author ? (
        <div>
          <p class="text-lg font-semibold">{author.name}</p>
          {author.role && <p class="text-sm">{author.role}</p>}
        </div>
        ) : <span />}
        <Rating value={5} readonly aria-label="Rated 5 out of 5" />
      </figcaption>
    </figure>
    )}
  </div>
</Section>

Add

npx @ava-ui/apogee add content/section-split-image-02

This copies the block to src/components/apogee/blocks/content/ with everything it uses: Button, Image, Prose, Rating, 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.