A brand-colour card: a heading and two buttons beside a photo.

Last updated

Open block
Show code
---
/**
 * Split image 04: A brand-colour card: a heading and two buttons beside a photo.
 *
 * @block cta
 * @order 8
 */
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 Image from '@/components/apogee/Image/Image.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { CTAContent } from '@/components/apogee/sections/_shared/cta.ts'

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

const {
  eyebrow,
  heading = 'Give us a shot',
  description = 'Join over 4,000+ startups already growing with us.',
  primaryAction = { label: 'Get started', href: '#' },
  secondaryAction = { label: 'Learn more', href: '#' },
  media = { src: 'https://picsum.photos/seed/apogee-cta-4/1200/1000', alt: '', width: 1200, height: 1000 },
} = Astro.props

---

<Section spacing="large">
  <div class="grid overflow-hidden rounded-2xl bg-primary text-on-primary lg:grid-cols-2">
    <div class="flex flex-col justify-center gap-8 p-8 md:p-16">
      <SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} background="primary" />
      {(primaryAction || secondaryAction) && (
      <div class="flex flex-col-reverse gap-3 sm:flex-row ">
      {secondaryAction && <Button href={secondaryAction.href} size="large" variant="outline" color="neutral" class="border-current! bg-transparent! text-inherit! shadow-none!">{secondaryAction.label}</Button>}
      {primaryAction && <Button href={primaryAction.href} size="large" color="neutral">{primaryAction.label}</Button>}
    </div>
      )}
    </div>
    {media && <Image src={media.src} alt={media.alt} width={media.width} height={media.height} fit="cover" class="min-h-72 size-full" />}
  </div>
</Section>

Add

npx @ava-ui/apogee add cta/split-image-04

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