HeroCoverpopular

apps/www/src/sections/HeroCover.astro · 51 lines · group Hero

HeroCover — the first screen with a full-bleed photo under the brand gradient and the text centered over it. `overlapNext` keeps room under the text for a card row that hangs over the section's edge (FeatureCards overlap); set it false when nothing follows.

In the fleet

Used on 3 sites built with this engine.

Samples 2

sample

Weather that pays offin the field, not on a grid cell

A station you install in an hour and forget about for a season. Frost, wind and leaf wetness measured inside the crop, not at the airport twenty kilometres away.

MDX of this sample
<HeroCover
  title="Weather that pays off"
  highlight="in the field, not on a grid cell"
  description="A station you install in an hour and forget about for a season. Frost, wind and leaf wetness measured inside the crop, not at the airport twenty kilometres away."
  image="photo-wide-01.jpg"
  primaryText="Order a station"
  primaryHref="/stations/"
  secondaryText="How it works"
  secondaryHref="/how-it-works/"
/>
sample

Every field on one screen

One dashboard for one orchard or forty. No buttons you will never press.

MDX of this sample
<HeroCover
  title="Every field on one screen"
  description="One dashboard for one orchard or forty. No buttons you will never press."
  image="photo-wide-02.jpg"
  overlapNext={false}
  primaryText="Book a demo"
  primaryHref="/demo/"
/>

Props

NameTypeRequiredDefaultDescription
titlestringyes
highlightstringaccent line rendered in the brand gradient under the title
descriptionstring
imagestring
overlapNextbooleantrue
primaryTextstring
primaryHrefstring'#'
secondaryTextstring
secondaryHrefstring'#'

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

---
/**
 * HeroCover — the first screen with a full-bleed photo under the brand
 * gradient and the text centered over it.
 *
 * `overlapNext` keeps room under the text for a card row that hangs over the
 * section's edge (FeatureCards overlap); set it false when nothing follows.
 */
import { Image } from 'astro:assets';
import { resolveImage } from '../lib/images';
import Button from './_Button.astro';

interface Props {
  title: string;
  /** accent line rendered in the brand gradient under the title */
  highlight?: string;
  description?: string;
  image?: string;
  overlapNext?: boolean;
  primaryText?: string;
  primaryHref?: string;
  secondaryText?: string;
  secondaryHref?: string;
}
const { title, highlight, description, image: imageName, overlapNext = true, primaryText, primaryHref = '#', secondaryText, secondaryHref = '#' } = Astro.props;
const image = imageName ? await resolveImage(imageName) : undefined;
---

<section class:list={['relative bg-primary-900', overlapNext && 'pb-32']}>
  {image && (
    <div class="absolute inset-0">
      <Image src={image} alt="" widths={[400, 840, 1280, 1680]} loading="eager" fetchpriority="high" class="h-full w-full object-cover" />
      <div class="absolute inset-0 bg-gradient-to-r from-primary-800 to-primary-alt-700 mix-blend-multiply" aria-hidden="true" />
    </div>
  )}
  <div class="relative mx-auto max-w-7xl px-4 py-24 text-center sm:px-6 sm:py-32 lg:px-8">
    <h1 class="text-4xl font-extrabold tracking-tight text-white md:text-5xl lg:text-6xl">
      {title}
      {highlight && <span class="block bg-gradient-to-r from-primary-200 to-primary-alt-300 bg-clip-text text-transparent">{highlight}</span>}
    </h1>
    {description && <p class="mx-auto mt-6 max-w-3xl text-xl text-primary-100">{description}</p>}
    <slot />
    {(primaryText || secondaryText) && (
      <div class="mt-10 flex flex-wrap justify-center gap-4">
        {primaryText && <Button href={primaryHref}>{primaryText}</Button>}
        {secondaryText && <Button href={secondaryHref} kind="secondary" onDark>{secondaryText}</Button>}
      </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.