Statpopular
apps/www/src/sections/Stat.astro · 20 lines · group Stats
Stat — one number of <Stats>: the value, its label and an optional detail line. The look follows the parent's variant (row / split / banner).
In the fleet
Used on 2 sites built with this engine.
Samples 1
<StatsBanner>IN NUMBERS
Measured, not estimated
Every figure below comes from stations that are running right now, in orchards, greenhouses and open fields.
MDX of this sample
<StatsBanner
kicker="IN NUMBERS"
title="Measured, not estimated"
description="Every figure below comes from stations that are running right now, in orchards, greenhouses and open fields."
image="photo-wide-03.jpg"
primaryText="See the coverage"
primaryHref="/coverage/"
>
<Stat value=">3 000" label="stations installed" detail="from a single greenhouse to a forty-field estate" />
<Stat value="99,4%" label="uptime last season" detail="counted per station, not per network" />
<Stat value="8 yrs" label="of readings" detail="the oldest station still reporting today" />
<Stat value="14" label="countries" detail="wherever the crop and the frost meet" />
</StatsBanner>Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| value | string | yes | ||
| label | string | yes | ||
| detail | string |
Source apps/www/src/sections/Stat.astro @ gitt.one
---
/**
* Stat — one number of <Stats>: the value, its label and an optional detail
* line. The look follows the parent's variant (row / split / banner).
*/
interface Props {
value: string;
label: string;
detail?: string;
}
const { value, label, detail } = Astro.props;
---
<div class="flex flex-col p-6 text-center [dl[data-variant=banner]_&]:p-0 [dl[data-variant=banner]_&]:text-left [dl[data-variant=split]_&]:border-t-2 [dl[data-variant=split]_&]:border-gray-100 [dl[data-variant=split]_&]:p-0 [dl[data-variant=split]_&]:pt-6 [dl[data-variant=split]_&]:text-left">
<dt class="order-2 mt-2 text-lg font-medium text-gray-500 [dl[data-variant=banner]_&]:mt-1 [dl[data-variant=banner]_&]:text-base [dl[data-variant=banner]_&]:text-gray-300">
{label}{detail && <span class="block text-base font-normal [dl[data-variant=banner]_&]:text-gray-300">{detail}</span>}
</dt>
<dd class="order-1 text-5xl font-extrabold text-primary-600 [dl[data-variant=banner]_&]:text-2xl [dl[data-variant=banner]_&]:font-bold [dl[data-variant=banner]_&]:text-white [dl[data-variant=split]_&]:text-3xl">{value}</dd>
</div>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.
