Skip to content

Commit fd38e2d

Browse files
committed
Improve metricStrip component.
1 parent 69f4924 commit fd38e2d

9 files changed

Lines changed: 198 additions & 129 deletions

File tree

‎frontend/purestack.studio/components/landing/index.mdx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ Thirteen components turn a page into a useful sequence: introduce the idea, expl
118118
</div>
119119
<h3>Metric<wbr/>Item</h3>
120120
<Badge tone="neutral">One useful number</Badge>
121-
<p>A compact value with a label, explanation and optional semantic icon.</p>
121+
<p>
122+
A prominent value with a clear label, supporting context, and an optional
123+
icon.
124+
</p>
122125
<a href="/components/landing/metric-item/">Explore MetricItem ↗</a>
123126
</article>
124127
<article class="component-guide-card">
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Grid columns="1" columnsMd="2" class="gap-5">
2+
<Panel tone="neutral" variant="surface" class="p-5">
3+
<MetricItem
4+
label="Preview build"
5+
value="1.8 s"
6+
detail="Local preview of a sample project."
7+
icon="lucide:clock"
8+
tone="accent"/>
9+
</Panel>
10+
<Panel tone="neutral" variant="surface" class="p-5">
11+
<MetricItem
12+
label="Availability"
13+
value="99.9%"
14+
detail="Example service over the last 30 days."
15+
icon="lucide:shield-check"
16+
tone="success"/>
17+
</Panel>
18+
</Grid>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Panel tone="neutral" variant="surface" class="p-5">
2+
<MetricItem
3+
label="Release readiness"
4+
value="Ready"
5+
detail="Every check in this example release is complete."
6+
icon="lucide:circle-check"
7+
tone="success"
8+
>
9+
<Flex wrap="true" align="center" class="gap-3">
10+
<Badge tone="success">8 of 8 checks</Badge>
11+
<BtnLink
12+
href="/components/"
13+
variant="link"
14+
tone="neutral"
15+
icon="lucide:arrow-right"
16+
iconPosition="end"
17+
>
18+
Review components
19+
</BtnLink>
20+
</Flex>
21+
</MetricItem>
22+
</Panel>

‎frontend/purestack.studio/components/landing/metric-item/metric-item.mdx‎

Lines changed: 39 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: MetricItem
3-
description: "A compact value with a label, explanation and optional semantic icon."
3+
description: "Make an important number stand out, with a clear label and the context readers need."
44
template: doc
55
layout:
66
showNav: true
@@ -16,14 +16,19 @@ nav:
1616
<ComponentHeader
1717
name="MetricItem"
1818
kind="One useful number"
19-
summary="A compact value with a label, explanation and optional semantic icon."
20-
source="https://github.com/PureStackStudio/PureStack/blob/main/packages/ts-components/src/standard/landing/landingTypes.ts"
19+
summary="Make an important number stand out, with a clear label and the context readers need."
20+
source="https://github.com/PureStackStudio/PureStack/blob/main/packages/ts-components/src/standard/landing/metricItem.ts"
2121
section="Landing &amp; pricing"
2222
sectionHref="/components/landing/"/>
2323

2424
## A value with context
2525

26-
Make the unit and time period part of the content.
26+
MetricItem puts the value first visually, with a label above it and supporting
27+
detail below. Use it for a product statistic, a project snapshot, or a short
28+
status. An optional icon helps readers recognize the subject at a glance.
29+
30+
Include units, time periods, or the source of a measurement in the content.
31+
These illustrative examples show two different kinds of value inside Panel.
2732

2833
<Tabs
2934
group="metric-item-sample-1"
@@ -35,33 +40,22 @@ Make the unit and time period part of the content.
3540
>
3641
<TabPane id="metric-item-sample-1-preview" label="Preview">
3742
<ComponentExample
38-
label="MetricItem in context"
39-
caption="Compare the composition, then open its source tab to adapt it."
43+
data-toc-ignore
44+
label="Numbers with a clear meaning"
45+
caption="A prominent value, a readable label, and just enough context. These are illustrative measurements."
4046
>
41-
<MetricItem
42-
label="Example build time"
43-
value="1.8 s"
44-
detail="Local preview, illustrative measurement"
45-
icon="lucide:check"
46-
tone="success"/>
47+
<import-content src="./_contextual-values.mdx"/>
4748
</ComponentExample>
4849
</TabPane>
4950
<TabPane id="metric-item-sample-1-source-0" label="contextual-value.mdx">
50-
```html
51-
<MetricItem
52-
label="Example build time"
53-
value="1.8 s"
54-
detail="Local preview, illustrative measurement"
55-
icon="lucide:check"
56-
tone="success"
57-
/>
58-
```
51+
<import-codeblock src="./_contextual-values.mdx" lang="html"/>
5952
</TabPane>
6053
</Tabs>
6154

6255
## Supporting content
6356

64-
Use the default slot for a qualifier or destination after the metric.
57+
Use the default slot to add a status badge, a short explanation, or a useful
58+
destination. MetricItem supplies the spacing; the content stays yours.
6559

6660
<Tabs
6761
group="metric-item-sample-2"
@@ -72,35 +66,26 @@ Use the default slot for a qualifier or destination after the metric.
7266
tabVariant="underline"
7367
>
7468
<TabPane id="metric-item-sample-2-preview" label="Preview">
75-
<div class="component-preview-stage">
76-
<MetricItem
77-
label="Documentation"
78-
value="Ready"
79-
detail="Review the components before release"
80-
>
81-
<BtnLink href="/components/" variant="link"
82-
>Browse component guides</BtnLink>
83-
</MetricItem>
84-
</div>
69+
<ComponentExample
70+
data-toc-ignore
71+
label="A status with a next step"
72+
caption="The value can be a word. Supporting content adds the detail and destination."
73+
>
74+
<import-content src="./_metric-detail.mdx"/>
75+
</ComponentExample>
8576
</TabPane>
8677
<TabPane id="metric-item-sample-2-source-0" label="metric-detail.mdx">
87-
```html
88-
<MetricItem
89-
label="Documentation"
90-
value="Ready"
91-
detail="Review the components before release"
92-
>
93-
<BtnLink href="/components/" variant="link">Browse component guides</BtnLink>
94-
</MetricItem>
95-
```
78+
<import-codeblock src="./_metric-detail.mdx" lang="html"/>
9679
</TabPane>
9780
</Tabs>
9881

9982
## All ten semantic tones
10083

101-
Every tone is visible on the icon frame. The row text keeps the surrounding text color.
84+
Tone colors the optional icon frame. The label, value, and detail keep the
85+
surrounding text color, so they also work inside a colored MetricStrip.
10286

10387
<ComponentExample
88+
data-toc-ignore
10489
label="All ten semantic tones"
10590
caption="Switch the site theme to compare the same samples in both palettes."
10691
>
@@ -112,12 +97,13 @@ Every tone is visible on the icon frame. The row text keeps the surrounding text
11297
## A number with the right context
11398

11499
<ComponentExample
100+
data-toc-ignore
115101
label="Display text, optional decoration, and supporting content"
116102
caption="value is display text; formatting, units, data fetching, and change calculations belong to your application."
117103
>
118104
<div class="component-appearance-grid">
119105
<div class="component-appearance-cell">
120-
<code>Minimal</code><MetricItem value="48"/>
106+
<code>Minimal, including zero</code><MetricItem value="0"/>
121107
</div>
122108
<div class="component-appearance-cell">
123109
<code>Label and detail</code><MetricItem label="Guides" value="13" detail="Updated this week"/>
@@ -155,7 +141,13 @@ This component exposes tone but no variant or variantMode. Its icon uses a fixed
155141

156142
## Behavior and accessibility
157143

158-
The value is text, so units and formatted numbers remain under your control. Tone affects the optional icon frame; it does not imply a trend or change the value’s meaning.
144+
The value is text, so units and formatted numbers remain under your control.
145+
Labels and details explain what it means; the icon is decorative. Tone affects
146+
the optional icon frame and does not imply a trend or change the value's meaning.
147+
148+
MetricItem uses existing typography and layout utilities and adds no custom
149+
stylesheet. It has no background of its own: use it directly, place it inside
150+
Panel, or group related items in MetricStrip.
159151

160152
## API reference
161153

@@ -183,8 +175,8 @@ The value is text, so units and formatted numbers remain under your control. Ton
183175
defaultValue="not set"
184176
>
185177
<p>
186-
Visible label. Use language that describes the control or value in its
187-
surrounding context.
178+
A short, readable label above the value. Name what is being measured or
179+
described.
188180
</p>
189181
</ApiProperty>
190182

@@ -235,7 +227,7 @@ The value is text, so units and formatted numbers remain under your control. Ton
235227
<div class="api-contract">
236228
<p>
237229
<strong>Default slot:</strong> content after the detail. Register
238-
defineMetricItemComponent with Flex and Icon dependencies.
230+
defineMetricItemComponent with Flex, IconFrame, and Icon dependencies.
239231
</p>
240232
</div>
241233

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<MetricStrip tone="accent" variant="surface" columnsSm="2" columnsLg="2">
2+
<MetricItem
3+
label="Completed tasks"
4+
value="8 of 10"
5+
detail="Two final details to review in this example."
6+
icon="lucide:circle-check"
7+
tone="accent"/>
8+
<MetricItem
9+
label="Next milestone"
10+
value="Review"
11+
detail="Bring the team together for the finishing touches."
12+
icon="lucide:users"
13+
tone="accent"
14+
>
15+
<BtnLink
16+
href="/guides/"
17+
tone="accent"
18+
variant="link"
19+
icon="lucide:arrow-right"
20+
iconPosition="end"
21+
>
22+
View guides
23+
</BtnLink>
24+
</MetricItem>
25+
</MetricStrip>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<MetricStrip tone="neutral">
2+
<MetricItem
3+
label="Pages"
4+
value="24"
5+
detail="Published in this workspace."
6+
icon="lucide:globe"
7+
tone="accent"/>
8+
<MetricItem
9+
label="Contributors"
10+
value="128"
11+
detail="People building together."
12+
icon="lucide:users"
13+
tone="info"/>
14+
<MetricItem
15+
label="Build time"
16+
value="1.8 s"
17+
detail="Latest local preview."
18+
icon="lucide:clock"
19+
tone="secondary"/>
20+
<MetricItem
21+
label="Checks passed"
22+
value="8/8"
23+
detail="Ready for the next step."
24+
icon="lucide:circle-check"
25+
tone="success"/>
26+
</MetricStrip>

0 commit comments

Comments
 (0)