LiveChallengeCard
Home's live challenge card: its name, dates and creators, the Live pill, gifts taken (25 pips) and the day of the challenge (30 ink pips), then sales, orders and commission. The whole card opens the challenge.
import { LiveChallengeCard } from '@ergasti/bricks';Examples
Live challenge on the home page
Title, dates, creators, gift and day progress as pips, and the sales, orders and commission so far. The whole card opens the challenge. The status word comes from the TRNDR preset.
Code
import { LiveChallengeCard } from '@ergasti/bricks';
function Live() {
return (
<div style={{ maxWidth: 560 }}>
<LiveChallengeCard title="Winter glow launch" dates="1 Nov → 30 Nov" creators={42} gifts={{ taken: 68, total: 100 }} days={{ current: 13, total: 30 }} sales="184300.00" orders={768} commission="27645.00" onOpen={() => {}} />
</div>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key liveChallengeCard, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
heading | Live challenge · {t} | تحدي شغّال · {t} |
sub | 2 · 2 creators joined | {d} · ليس رقمًا صانع محتوى اشتركوا |
gifts | Gifts taken | الهدايا اللي اتاخدت |
days | Days | الأيام |
dayOf | Day {d} of {n} | اليوم {d} من {n} |
sales | Sales | المبيعات |
orders | Orders | الطلبات |
commission | Commission | العمولة |
Design guidance
How the BRICKS design system uses LiveChallengeCard. Written in docs/content/components/LiveChallengeCard.md; the props above are read from the code, which wins where the two disagree.
Home's live challenge card: the challenge name, dates and creators joined, a Live pill, gifts taken and days as pip rows, then sales, orders and commission; the whole card opens the challenge.
It is the mock's .card.s7.click on Brand › Home. The card is a kit Card with one stretched button named "Live challenge · Winter glow launch"; the figures' money "?" notes sit above it. Money comes as 2-dp strings and shows compact ("EGP 184.3K").
Anatomy
- Card:
article.kit-card.kit-blk-live, lifts on hover. - Hit button: covers the card, named by the heading.
- Header: h2 "Live challenge · Winter glow launch" (
dir="auto"), sub "1 Nov → 30 Nov · 42 creators joined",StatusPill status="live". - Gifts row:
ProgressRow"Gifts taken", 25 pips, "68 / 100". - Days row:
ProgressRow"Days", one ink pip per day (max 31), "Day 13 of 30". - Figures:
KeyValue columns={3}: Sales (challenge_sales), Orders, Commission (challenge_commission).
Variants
| Prop | Values | When |
|---|---|---|
money | MoneyDisplay | Default compact; slot liveChallengeCard.figures. |
States
| State | Trigger |
|---|---|
| Default / hover | lift. |
| Focus-visible | inset ring (--focus-ring-inset) drawn just inside the card edge by its stretched button. |
| First day | zeros: empty pips, "Day 1 of 30", "EGP 0". |
| Long title | wraps in the header. |
Types
LiveChallengeCopy (labels): heading(t), sub(d, n), gifts, days, dayOf(d, n), sales, orders, commission.
Usage
// Brand › Home, beside Top creators
<LiveChallengeCard title="Winter glow launch" dates="1 Nov → 30 Nov" creators={42}
gifts={{ taken: 68, total: 100 }} days={{ current: 13, total: 30 }}
sales="184300.00" orders={768} commission="27645.00"
onOpen={() => navigate('/motivation?challenge=winter-glow')} />Where it appears
- Brand › Home › Live challenge card (BrandHome).
Guidelines
Do
- Show it only while a challenge is live; hide it otherwise.
Don't
- Don't add buttons inside; the card opens the challenge.
RTL and Arabic
- Mirrors; pips fill from the right. Arabic: "تحدي شغّال · …", "اليوم 13 من 30", dates "1 نوفمبر → 30 نوفمبر".
Tokens
--card, --line, --r-lg, --rasp, --ink, --track, --soft, --ink-3.
Accessibility
- One button named by the heading; pips are decorative with the value in words; money labels keep their "?".
Found in the source
- ARIA attributes set:
aria-label.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
ChallengeCard,ChallengeDetail: the Motivation screen's cards and drawer.ProgressRow,KeyValue,StatusPill.
See also: Money · useLanguage · useMoneyDisplay
Source
src/blocks/home/LiveChallengeCard.tsx (line 55) on GitHub.