CtaBanner

apps/www/src/sections/CtaBanner.astro · 59 lines · group Call to action

CtaBanner — the wide call to action: the title (with an optional brand-gradient line) on the left, the buttons on the right, on a full-width band. Use for: the closing prompt of a landing page, or the prompt between two content blocks — "Ready to start? Contact us". Not for: a short one-line invitation (<CtaCentered>); a prompt with a picture (<CtaSplit>, <CtaPanel>); a price (<CtaPrice>). Children: none. Theme: "light" (default), "muted", "dark", "brand" or "brand-dark" — dark themes turn the text white. Buttons: a button appears only when its text is given.

In the fleet

Used on 1 site built with this engine.

Samples 2

sample

Ready to put a station in the field?We ship within a week.

Tell us the crop and the field, and we will tell you which sensors are worth the money.

MDX of this sample
<CtaBanner
  title="Ready to put a station in the field?"
  highlight="We ship within a week."
  description="Tell us the crop and the field, and we will tell you which sensors are worth the money."
  primaryText="Order a station"
  primaryHref="/stations/"
  secondaryText="Talk to us"
  secondaryHref="/contact/"
/>
sample

Frost season starts in six weeks

Stations installed before it starts pay for themselves in the first cold night.

MDX of this sample
<CtaBanner
  theme="dark"
  title="Frost season starts in six weeks"
  description="Stations installed before it starts pay for themselves in the first cold night."
  primaryText="Book an installation"
  primaryHref="/install/"
/>

Props

NameTypeRequiredDefaultDescription
idstringanchor of the section
titlestringyesthe prompt, one line
highlightstringa second line under the title, painted with the brand gradient
descriptionstringa sentence under the title
theme'light' | 'muted' | 'dark' | 'brand' | 'brand-dark''light'background of the band
primaryTextstringtext of the solid brand button; omit to hide the button
primaryHrefstring'#'link of the primary button, e.g. "/contacts/"
secondaryTextstringtext of the second, outlined button
secondaryHrefstring'#'link of the secondary button

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

---
/**
 * CtaBanner — the wide call to action: the title (with an optional
 *   brand-gradient line) on the left, the buttons on the right, on a
 *   full-width band.
 *
 * Use for: the closing prompt of a landing page, or the prompt between two
 *   content blocks — "Ready to start? Contact us".
 * Not for: a short one-line invitation (<CtaCentered>); a prompt with a
 *   picture (<CtaSplit>, <CtaPanel>); a price (<CtaPrice>).
 * Children: none.
 * Theme: "light" (default), "muted", "dark", "brand" or "brand-dark" — dark
 *   themes turn the text white.
 * Buttons: a button appears only when its text is given.
 */
import Section from './_Section.astro';
import type { Theme } from './_Section.astro';
import Button from './_Button.astro';

interface Props {
  /** anchor of the section */
  id?: string;
  /** the prompt, one line */
  title: string;
  /** a second line under the title, painted with the brand gradient */
  highlight?: string;
  /** a sentence under the title */
  description?: string;
  /** background of the band */
  theme?: Theme;
  /** text of the solid brand button; omit to hide the button */
  primaryText?: string;
  /** link of the primary button, e.g. "/contacts/" */
  primaryHref?: string;
  /** text of the second, outlined button */
  secondaryText?: string;
  /** link of the secondary button */
  secondaryHref?: string;
}
const { id, title, highlight, description, theme = 'light', primaryText, primaryHref = '#', secondaryText, secondaryHref = '#' } = Astro.props;
const dark = theme === 'dark' || theme === 'brand';
---

<Section id={id} theme={theme}>
  <div class="lg:flex lg:items-center lg:justify-between">
    <div>
      <h2 class="text-4xl font-extrabold tracking-tight">
        <span class="block">{title}</span>
        {highlight && <span class="block bg-gradient-to-r from-primary-500 to-primary-alt-600 bg-clip-text text-transparent">{highlight}</span>}
      </h2>
      {description && <p class="mt-4 max-w-2xl text-xl text-gray-500 [.bg-stone-800_&]:text-primary-100">{description}</p>}
    </div>
    <div class="mt-8 flex flex-wrap gap-4 lg:mt-0 lg:ml-8">
      {primaryText && <Button href={primaryHref}>{primaryText}</Button>}
      {secondaryText && <Button href={secondaryHref} kind="secondary" onDark={dark}>{secondaryText}</Button>}
    </div>
  </div>
</Section>

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