Skip to main content
⌘K

Search

Search pages, pieces and blocks.

Feature grid/A Section header and six plain Cards, three across, each with an icon or a picture on top.

components/blocks/feature-grid.tsx
"use client"
import {  CloudRainIcon,  LifeRingIcon,  MapPinIcon,  SurfboardIcon,  UsersIcon,  WavesIcon,  type IconComponent,} from "@/components/icons"import { AspectRatio } from "@/components/ui/aspect-ratio"import { Card, CardDescription, CardHeader, CardIcon, CardMedia, CardTitle } from "@/components/ui/card"import {  PageHeader,  PageHeaderContent,  PageHeaderDescription,  PageHeaderTitle,} from "@/components/ui/page-header"
// Feature grid: a Section header and six Cards in the plain look, three// across from 1024px, two from 768px, one on a phone. Two states: icons, each// Card with CardIcon beside its title; and pictures, each with CardMedia on// its top edge (the muted fill and the icon stand in until a photo goes in).
type FeatureGridState = "icons" | "pictures"
const features: { icon: IconComponent; title: string; description: string }[] = [  { icon: WavesIcon, title: "Every level", description: "Beginner, Improver and Private lessons, in groups of five at most." },  { icon: CloudRainIcon, title: "Weather holds", description: "The forecast is checked the evening before. A lesson the sea cancels moves, or comes back in full." },  { icon: MapPinIcon, title: "Seven beaches", description: "From Ericeira to Sagres, each with its own school and one clear meeting point." },  { icon: SurfboardIcon, title: "Gear at the beach", description: "Board, wetsuit and leash wait on the sand, sized at booking." },  { icon: UsersIcon, title: "Named instructors", description: "Every lesson names its instructor, with level and languages spoken." },  { icon: LifeRingIcon, title: "Safe water", description: "A certified lifeguard in every group and a first aid kit on the sand." },]
function FeatureGridBlock({ state }: { state?: FeatureGridState }) {  const pictures = (state ?? "icons") === "pictures"  return (    <section className="mx-auto flex w-full max-w-6xl flex-col gap-10 px-6 py-16 md:py-24">      <PageHeader>        <PageHeaderContent className="max-w-xl">          <PageHeaderTitle level={2} size="heading">Why surf with Maré</PageHeaderTitle>          <PageHeaderDescription>One way to book every school on the coast, with the details that matter on the day.</PageHeaderDescription>        </PageHeaderContent>      </PageHeader>      <div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">        {features.map(({ icon: Icon, title, description }) =>          pictures ? (            <Card key={title} look="plain">              <CardMedia>                <AspectRatio ratio={16 / 9}>                  <div className="absolute inset-0 flex items-center justify-center">                    <Icon className="size-6" />                  </div>                </AspectRatio>              </CardMedia>              <CardHeader>                <CardTitle>{title}</CardTitle>                <CardDescription>{description}</CardDescription>              </CardHeader>            </Card>          ) : (            <Card key={title} look="plain">              <CardHeader>                <CardIcon className="self-start">                  <Icon />                </CardIcon>                <CardTitle>{title}</CardTitle>                <CardDescription>{description}</CardDescription>              </CardHeader>            </Card>          )        )}      </div>    </section>  )}
export { FeatureGridBlock }export type { FeatureGridState }