CtaPanel

apps/www/src/sections/CtaPanel.astro · 43 lines · group Call to action

CtaPanel — a call to action inside a brand panel, with a picture filling its left edge. Louder than <CtaBanner>: the whole block is the brand colour.

In the fleet

Not used by any site yet.

Samples 1

sample

Bring the network to your co-op

Ten farms, one gateway, one bill.

Members share the gateway and the forecasts; each farm keeps its own data and its own alerts.

MDX of this sample
<CtaPanel
  title="Bring the network to your co-op"
  highlight="Ten farms, one gateway, one bill."
  description="Members share the gateway and the forecasts; each farm keeps its own data and its own alerts."
  image="photo-03.jpg"
  primaryText="Talk to us"
  primaryHref="/contact/"
  secondaryText="How sharing works"
  secondaryHref="/coop/"
/>

Props

NameTypeRequiredDefaultDescription
idstring
titlestringyes
highlightstringa lead line under the title
descriptionstring
imagestring
themeTheme'light'
primaryTextstring
primaryHrefstring'#'
secondaryTextstring
secondaryHrefstring'#'

Source apps/www/src/sections/CtaPanel.astro @ gitt.one

---
/**
 * CtaPanel — a call to action inside a brand panel, with a picture filling
 * its left edge. Louder than <CtaBanner>: the whole block is the brand colour.
 */
import { Image } from 'astro:assets';
import { resolveImage } from '../lib/images';
import Section from './_Section.astro';
import type { Theme } from './_Section.astro';
import Button from './_Button.astro';

interface Props {
  id?: string;
  title: string;
  /** a lead line under the title */
  highlight?: string;
  description?: string;
  image?: string;
  theme?: Theme;
  primaryText?: string;
  primaryHref?: string;
  secondaryText?: string;
  secondaryHref?: string;
}
const { id, title, highlight, description, image, theme = 'light', primaryText, primaryHref = '#', secondaryText, secondaryHref = '#' } = Astro.props;
const img = image ? await resolveImage(image) : undefined;
---

<Section id={id} theme={theme}>
  <div class="overflow-hidden rounded-3xl bg-primary-700 text-white lg:grid lg:grid-cols-12 lg:items-center">
    {img && <Image src={img} alt="" widths={[400, 840]} class="aspect-[2/1] w-full object-cover lg:col-span-4 lg:aspect-square lg:h-full" />}
    <div class:list={['space-y-6 px-6 py-12 sm:px-10 lg:py-16', img ? 'lg:col-span-8' : 'lg:col-span-12']}>
      <h2 class="text-3xl font-extrabold">{title}</h2>
      {highlight && <p class="text-lg">{highlight}</p>}
      {description && <p class="text-lg">{description}</p>}
      <div class="flex flex-wrap gap-4">
        {primaryText && <Button href={primaryHref} kind="secondary" onDark>{primaryText}</Button>}
        {secondaryText && <Button href={secondaryHref} kind="secondary" onDark>{secondaryText}</Button>}
      </div>
    </div>
  </div>
</Section>

Source links point to engine-astro@38c294d9. Samples are demo content: the components are the real ones, the copy and the pictures are made up.