GiftAttentionList
Gift analytics' "Needs attention" card body, on MiniList variant="soft" and MiniRow: the brand's square, a bold line and a muted line, for each brand out of gifts and each shipment still to count, the whole row one button when onSelect is set. The state word ("Expected", "Arrived") comes from the provider's statusTables.pr. "Nothing waiting." when the list is empty. The card and its heading are the screen's (Card title).
import { GiftAttentionList } from '@ergasti/bricks';Examples
Needs attention
Brands out of gifts and shipments still to count, as on Gift analytics: each row opens the brand or the shipment (onSelect). The state word comes from the TRNDR preset's status table.
Code
import { Card, GiftAttentionList } from '@ergasti/bricks';
import { useState } from 'react';
import { brands } from './pr';
function NeedsAttention() {
const [opened, setOpened] = useState('Nothing opened yet');
return (
<div style={{ display: 'grid', gap: 10, maxWidth: 640 }}>
<Card title="Needs attention">
<GiftAttentionList items={[
{ id: 'mira', kind: 'out', brand: brands.mira, onSelect: () => setOpened('Mira Beauty') },
{ id: 'GS-0017', kind: 'check', brand: brands.glow, reference: 'GS-0017', units: 40, state: 'expected', onSelect: () => setOpened('GS-0017') },
{ id: 'GS-0013', kind: 'check', brand: brands.kemet, reference: 'GS-0013', units: 40, state: 'arrived', onSelect: () => setOpened('GS-0013') },
]} />
</Card>
<small>{opened}</small>
</div>
);
}Nothing waiting
An empty list draws one muted line; pass empty for your own words.
Code (not run)
import { Card, GiftAttentionList } from '@ergasti/bricks';
function NothingWaiting() {
return <Card title="Needs attention"><GiftAttentionList items={[]} /></Card>;
}Arabic
The same rows in Egyptian Arabic, right to left.
Code
import { Card, GiftAttentionList } from '@ergasti/bricks';
import { brands } from './pr';
function Arabic() {
return (
<Card title="محتاج انتباه">
<GiftAttentionList language="ar" items={[
{ id: 'mira', kind: 'out', brand: brands.mira, onSelect: () => {} },
{ id: 'GS-0016', kind: 'check', brand: brands.glow, reference: 'GS-0016', units: 30, state: 'arrived', onSelect: () => {} },
]} />
</Card>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prGiftAttention, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
label | Needs attention | محتاج انتباه |
out | Out of gifts · ask for more stock | الهدايا خلصت · اطلب مخزون زيادة |
check | {units} units to check · {state} | {units} وحدة محتاجة مراجعة · {state} |
none | Nothing waiting. | مفيش حاجة مستنية. |
Design guidance
How the BRICKS design system uses GiftAttentionList. Written in docs/content/components/GiftAttentionList.md; the props above are read from the code, which wins where the two disagree.
The body of Gift analytics' "Needs attention" card: one soft row per brand out of gifts and per shipment still to count, each row one button; put it in a Card title="Needs attention".
GiftAttentionList is the PR v3 mock's "Needs attention" card rows on P.ganalytics. Each row has the brand's square (BrandAvatar), a bold line and a muted line: "Mira Beauty" over "Out of gifts · ask for more stock" (kind: 'out'), or "GS-0017 · Glow Lab" over "40 units to check · Expected" (kind: 'check'), with the state word taken from the provider's statusTables.pr. kind: 'custom' takes the app's own lines. It is built on MiniList variant="soft" and MiniRow; the card and heading are the screen's.
Anatomy
- List:
MiniList variant="soft"(<ul>, 8px gap) named "Needs attention", inside.kit-pr-gatt. - Row:
MiniRowon--soft, padding 12 16, radius 16; a<button>whenonSelectis set. - Lead:
BrandAvatarwith the brand'snameandcolor. - Title: bold, 13.5px, wraps (no ellipsis).
- Sub: muted, 12.5px, wraps.
- Empty: a muted "Nothing waiting." line instead of the list.
Variants
kind | Title / sub | When to use |
|---|---|---|
out | Brand name / "Out of gifts · ask for more stock" | A brand with no confirmed gifts left |
check | "{reference} · {brand}" / "{units} units to check · {state}" | A shipment PR still has to count (state: expected, arrived, …) |
custom | title (default the brand name) / sub | Any other reason a brand needs PR |
States
| State | Trigger |
|---|---|
| Static row | no onSelect |
| Clickable row | onSelect: the whole row is one button; hover darkens the grey, focus shows the ring at the row's 16px radius |
| Empty | items=[]: "Nothing waiting." (or empty) |
| Long text | titles and subs wrap (overflow-wrap: anywhere) |
Usage
import { Card, GiftAttentionList, GiftShipmentCounts, PageGrid } from '@ergasti/bricks';
const brands = {
glow: { id: 'glow', name: 'Glow Lab', color: '#C7325C' },
mira: { id: 'mira', name: 'Mira Beauty', color: '#5B3BB0' },
kemet: { id: 'kemet', name: 'Kemet Home', color: '#3D5A10' },
};
export function GiftAnalyticsBottom({ openBrand, openShipment }: { openBrand: (id: string) => void; openShipment: (id: string) => void }) {
return (
<PageGrid split="7-5" align="start">
<Card title="Needs attention">
<GiftAttentionList items={[
{ id: 'mira', kind: 'out', brand: brands.mira, onSelect: () => openBrand('mira') },
{ id: 'GS-0017', kind: 'check', brand: brands.glow, reference: 'GS-0017', units: 40, state: 'expected', onSelect: () => openShipment('GS-0017') },
{ id: 'GS-0013', kind: 'check', brand: brands.kemet, reference: 'GS-0013', units: 40, state: 'arrived', onSelect: () => openShipment('GS-0013') },
]} />
</Card>
<Card title="Shipments">
<GiftShipmentCounts counts={{ gift_expected: 3, gift_arrived: 2, gift_confirmed: 1, gift_confirmed_diff: 1 }} problems={1} />
</Card>
</PageGrid>
);
}// Nothing waiting, in your own words
import { Card, GiftAttentionList } from '@ergasti/bricks';
export function AllClear() {
return <Card title="Needs attention"><GiftAttentionList items={[]} empty="Every brand has gifts and every shipment is counted." /></Card>;
}Where it appears
- PR Portal › Gift stock › Gift analytics › "Needs attention" (the mock's
P.ganalytics; anoutrow opens the brand, acheckrow the shipment), beside the shipment counts. Screen: PR · Gift analytics. - Dashboard screen: PrGiftAnalytics.
Guidelines
Do
- List out-of-gift brands first, then shipments to count (the mock's order).
- Give every row
onSelect, so PR can act on it in one press. - Pass
labelwhen the card's title differs from "Needs attention".
Don't
- Don't add a trailing pill or chevron; the row reads as a button already.
- Don't write the state word yourself for
checkrows; it follows the status table.
RTL and Arabic
Rows mirror (the square on the right); lines are dir="auto", so "GS-0017 · Glow Lab" keeps its order. Arabic: "محتاج انتباه", "الهدايا خلصت · اطلب مخزون زيادة", "{units} وحدة محتاجة مراجعة · {state}", "مفيش حاجة مستنية."; the state word comes from the table's ar. Override with labels or labels.prGiftAttention.
Tokens
--soft, --ink-3, --rasp (title on hover), --focus-ring, --radius-xs (MiniList), BrandAvatar colour.
Accessibility
- A
<ul>witharia-label(default "Needs attention"); each clickable row is a<button>whose name is its two lines. - Focus-visible ring on the button; rows are 44px tall under 1024px (MiniRow).
BrandAvataris decorative beside the brand's name.
Found in the source
- Its tests cover: “is built on MiniList variant=”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
MiniList/MiniRow: the rows it is built on.GiftShipmentCounts: the shipment status counts beside it.GiftStockList,BrandGiftStockCard: Gift stock's own lists and cards.
See also: useBricks · useLanguage · BrandAvatar · Card · GiftClaimCheck · GiftShipmentCard
Source
src/pr/ganalytics/GiftAttentionList.tsx (line 66) on GitHub.