FeatureAsidepopular

apps/www/src/sections/FeatureAside.astro · 69 lines · group Features & lists

FeatureAside — the heading, a paragraph and an optional picture on the left; a dense icon-and-text list of <Feature> on the right. Use for: one subject explained in several points — "how we work", "what is included", "why it matters" — where the points support the heading rather than compete with it. Not for: parallel offers of equal weight (<FeatureCards>); a numbered sequence (<Steps>). Children: <Feature> tags, three to six. The icon of each sits to the left of its text. Picture: `image` is placed under the heading text on the left; any proportions, shown whole. Link: `linkText` + `href` add one centered button under the block.

In the fleet

Used on 2 sites built with this engine.

Samples 1

sample

IN THE FIELD

Small enough to forget, stubborn enough to trust

The parts that matter are the ones you never think about: the seal, the mount and the radio.

  • Sealed to IP67

    Rain, dust and a pressure washer at the end of the season.

  • Four kilometres

    Line of sight to the gateway, on a licence-free band.

  • Field calibration

    Swap a sensor and the station recognises it by itself.

MDX of this sample
import BoltIcon from 'astro-heroicons/outline/Bolt.astro';
import SignalIcon from 'astro-heroicons/outline/Signal.astro';
import ShieldIcon from 'astro-heroicons/outline/ShieldCheck.astro';

<FeatureAside
  theme="muted"
  kicker="IN THE FIELD"
  title="Small enough to forget, stubborn enough to trust"
  description="The parts that matter are the ones you never think about: the seal, the mount and the radio."
  image="photo-01.jpg"
>
  <Feature title="Sealed to IP67" description="Rain, dust and a pressure washer at the end of the season." Icon={ShieldIcon} />
  <Feature title="Four kilometres" description="Line of sight to the gateway, on a licence-free band." Icon={SignalIcon} />
  <Feature title="Field calibration" description="Swap a sensor and the station recognises it by itself." Icon={BoltIcon} />
</FeatureAside>

Props

NameTypeRequiredDefaultDescription
idstringanchor of the section
kickerstringshort uppercase line above the title
titlestringthe section heading, left column
descriptionstringa paragraph under the heading, left column
theme'light' | 'muted' | 'dark' | 'brand' | 'brand-dark''light'background of the section
decor'none' | 'dots' | 'dots-left''none'decorative dot grid behind the content
imagestringfile name in images/, shown under the heading text
linkTextstringtext of one centered button under the block; shown only with href
hrefstringlink of that button
classstringescape hatch for compositions: extra classes for the section shell

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

---
/**
 * FeatureAside — the heading, a paragraph and an optional picture on the left;
 *   a dense icon-and-text list of <Feature> on the right.
 *
 * Use for: one subject explained in several points — "how we work", "what is
 *   included", "why it matters" — where the points support the heading rather
 *   than compete with it.
 * Not for: parallel offers of equal weight (<FeatureCards>); a numbered
 *   sequence (<Steps>).
 * Children: <Feature> tags, three to six. The icon of each sits to the left of
 *   its text.
 * Picture: `image` is placed under the heading text on the left; any
 *   proportions, shown whole.
 * Link: `linkText` + `href` add one centered button under the block.
 */
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 {
  /** anchor of the section */
  id?: string;
  /** short uppercase line above the title */
  kicker?: string;
  /** the section heading, left column */
  title?: string;
  /** a paragraph under the heading, left column */
  description?: string;
  /** background of the section */
  theme?: Theme;
  /** decorative dot grid behind the content */
  decor?: 'none' | 'dots' | 'dots-left';
  /** file name in images/, shown under the heading text */
  image?: string;
  /** text of one centered button under the block; shown only with href */
  linkText?: string;
  /** link of that button */
  href?: string;
  /** escape hatch for compositions: extra classes for the section shell */
  class?: string;
}

const { id, kicker, title, description, theme = 'light', decor = 'none', image, linkText, href, class: extra = '' } = Astro.props;
const img = image ? await resolveImage(image) : undefined;
---

<Section id={id} theme={theme} heading="sr" class={extra} decor={decor}>
  <div class="lg:grid lg:grid-cols-2 lg:items-start lg:gap-x-16">
    <div>
      {kicker && <p class="text-sm font-semibold uppercase tracking-wide"><span class="bg-gradient-to-r from-primary-500 to-primary-alt-600 bg-clip-text text-transparent [.bg-gradient-to-r_&]:from-primary-100 [.bg-gradient-to-r_&]:to-primary-alt-400">{kicker}</span></p>}
      {title && <h2 class="mt-3 text-3xl font-extrabold tracking-tight sm:text-4xl">{title}</h2>}
      {description && <p class="mt-4 text-lg text-gray-500 [.bg-stone-800_&]:text-primary-100 [.bg-gradient-to-r_&]:text-primary-100">{description}</p>}
      {img && <Image src={img} alt="" widths={[400, 840]} class="mt-8 w-full rounded-lg shadow-lg" />}
    </div>
    <ul
      class="mt-10 grid list-none grid-cols-1 gap-y-8 lg:mt-0"
      data-variant="plain"
      data-aside=""
      data-on-dark={theme === 'brand' || theme === 'dark' ? '' : undefined}
    >
      <slot />
    </ul>
  </div>
  {linkText && href && <p class="mt-10 text-center"><Button href={href}>{linkText}</Button></p>}
</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.