PrStatusPill
A PR status in its tone, from the BricksProvider's statusTables.pr (the TRNDR preset's TRNDR_PR_STATUSES with no provider). An unknown key shows as itself, muted (never a blank cell).
import { PrStatusPill } from '@ergasti/bricks';Examples
PR statuses
The PR portal's own status table (statusTables.pr): live, upcoming, settling, needs review and the rest. This example uses the TRNDR preset's table.
Code
import { PrStatusPill, TRNDR_PR_STATUSES } from '@ergasti/bricks';
function Statuses() {
return <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>{Object.keys(TRNDR_PR_STATUSES).map((status) => <PrStatusPill key={status} status={status} />)}</div>;
}Wallet health
Four states; below zero it counts the days to the pause (day of graceDays, 7 by default).
Code
import { WalletHealthPill } from '@ergasti/bricks';
function Health() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
<WalletHealthPill health="ok" /><WalletHealthPill health="low" /><WalletHealthPill health="negative" day={4} /><WalletHealthPill health="paused" />
</div>
);
}A longer grace period
graceDays is how many days below zero before coupons pause (default 7): "day 4 of 10".
Code
import { WalletHealthPill } from '@ergasti/bricks';
function Grace() {
return <WalletHealthPill health="negative" day={4} graceDays={10} />;
}Props
Prop
Type
Design guidance
How the BRICKS design system uses PrStatusPill. Written in docs/content/components/PrStatusPill.md; the props above are read from the code, which wins where the two disagree.
A pill that shows one PR Portal status key in its tone and the reader's language; use it in every PR table cell, card header and drawer that shows a status.
PrStatusPill looks the key up in the BricksProvider's statusTables.pr (the TRNDR preset's TRNDR_PR_STATUSES) and renders the kit Pill with that row's tone and English or Arabic word. One table drives every PR screen, so "Live", "Needs review", "Receipt uploaded" or "Confirmed with difference" read and colour the same everywhere. An unknown key is shown as itself, muted, never a blank cell.
Anatomy
- Pill: a
<span class="kit-chip kit-chip--<tone>">, 12px / 700, padding4px 10px, radius 99px, no wrap. - Word: the table row's
enorarlabel.
Variants
The tone comes from the status table, not from a prop. The preset's keys by tone:
| Tone | Look | Keys in TRNDR_PR_STATUSES (English word) |
|---|---|---|
ok | green on green tint | active Active, live Live, creator_active Active, paid Paid, receipt_uploaded Receipt uploaded, topup_confirmed Confirmed, gift_confirmed Confirmed, gift_ok OK, request_approved Approved, campaign_scheduled Scheduled, link_on Link on, switch_on On |
warn | butter | settling Settling, needs_review Needs review, pending Pending, due Due, receipt_missing No receipt, topup_pending Waiting for transfer, gift_confirmed_diff Confirmed with difference, gift_low Running low, request_waiting Brand request |
bad | raspberry tint, bad ink | rejected Rejected, failed Failed, topup_failed Failed, gift_problem Problem reported, gift_out Out of gifts, request_declined Declined, switch_off Off, pauses_in Pauses soon |
sky | sky | upcoming Upcoming, new_request New request, brand_invite Brand invite, processing Processing, gift_expected Expected, trndr_wide TRNDR-wide |
lilac | lilac | public_challenge Public challenge, gift_arrived Arrived |
lime | lime, olive ink | waiting_count Waiting |
mute | soft grey | paused Paused, ended Ended, creator_request Creator request, link_off Link off, customers_off Off for all brands, gift_cancelled Cancelled; and any key not in the table, shown as the raw key |
Activity-log areas (approvals, programs, payouts, roles, …) are not PR statuses: they live in TRNDR_AUDIT_AREAS (statusTables.prAudit) and are drawn by AuditAreaPill. <PrStatusPill status="approvals" /> shows the raw word "approvals" in grey.
States
| State | Trigger |
|---|---|
| Known status | status is a key of statusTables.pr: its tone and word |
| Unknown status | any other string: the raw key, mute tone |
| Arabic | language="ar" or the provider's language: the row's ar word |
Types
status: a key of the provider's statusTables.pr (type PrStatus for the preset's keys; isPrStatus(value) narrows a string).
Usage
import { PrStatusPill } from '@ergasti/bricks';
<PrStatusPill status="needs_review" />// Affiliate programs table: the status column
const columns: DataColumn<Program>[] = [
{ key: 'brand', label: 'Brand', render: (p) => <BrandCell name={p.brand} sub="10% of sale" />, primary: true },
{ key: 'status', label: 'Status', render: (p) => <PrStatusPill status={p.status} /> }, // 'live' | 'paused' | 'needs_review'
{ key: 'sales', label: 'Sales', align: 'end', render: (p) => <Money value={p.sales} /> },
];
<DataTable label="Affiliate programs" rows={programs} columns={columns} rowKey={(p) => p.id} onRowClick={openProgram} />// Override one word for the whole app through the provider
<BricksProvider preset={trndrPreset} statusTables={{ pr: { ...TRNDR_PR_STATUSES, receipt_missing: { tone: 'bad', en: 'Receipt needed', ar: 'محتاج إيصال' } } }}>
<App />
</BricksProvider>Where it appears
- PR Portal › Affiliate programs › campaigns table status; a campaign's page › status card.
- PR Portal › Creators › creators table status (
creator_active,pending,rejected). - PR Portal › Gift stock › shipments table (through
GiftStatusPills), Gift analytics › "Shipments from brands" (GiftShipmentCounts). - Library-only (no v3 mock screen): payouts and receipts (
due,paid,receipt_missing), wallet top-ups (topup_pending). - Dashboard screens: PrPrograms, PrCreators, PrGifts, PrGiftAnalytics.
Guidelines
Do
- Pass the domain key (
gift_confirmed_diff), never a display word: the table owns the words. - Add new statuses to the provider's table with both
enandar. - Keep one pill per cell;
GiftStatusPillsis the only place two sit together.
Don't
- Don't colour it by hand or wrap it in a coloured box: the tone only repeats what the word says.
- Don't use it for counts ("5 waiting"): use
PrCountPill. - Don't use it for a wallet's health: use
WalletHealthPill, which formats the grace-day count.
RTL and Arabic
The pill follows the text direction. Arabic words come from the table's ar; the chip's line height uses --lh-ar where the theme sets it for Cairo.
Tokens
--ok-bg, --ok, --butter, --butter-ink, --rasp-50, --bad, --soft, --ink-2, --sky, --sky-ink, --lime, --olive, --lilac, --lilac-ink, --lh-ar.
Accessibility
Plain text in a <span>: screen readers read the word. Colour is never the only signal. Tone pairs are the mock's tinted fills with ink-strength text.
Found in the source
- No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
WalletHealthPill: a wallet's health with the below-zero day count.PrCountPill: a status with a number ("Pauses in 3 days", "5 waiting").FraudStatusPill/FraudSignalPill: fraud review words.StatusPill/Pill(kit): brand-dashboard statuses, or a free tone.
See also: useBricks · useLanguage · DecisionLine · DecisionTag · DecisionTagsProvider · IconSquare
Source
src/pr/PrStatus.tsx (line 18) on GitHub.