PrChallengeCard
The PR Challenges tab's card (the v3 mock's chCard): a tinted band with the type and audience and the status pill; the name, the brand; dates, time left and a thin time bar; the goal and reward chips; then the top three now (a leaderboard) or how many hit the goal (a target); a footer with the faces, how many joined, the budget held and an arrow. The name is the card's one button (it covers the card, so the whole card opens the challenge); the money "?" notes stay their own buttons above it.
import { PrChallengeCard } from '@ergasti/bricks';Examples
A live leaderboard card
The whole card opens the challenge; the money notes stay their own buttons. A leader's seed sets their avatar colour when the row id is not your palette index, so a creator keeps one colour across lists; left out, the id is the seed.
Code
import { PrChallengeCard } from '@ergasti/bricks';
function Card() {
return (
<div style={{ maxWidth: 420, display: 'flex' }}>
<PrChallengeCard name="Winter top 10" brand={{ id: 'glow', name: 'Glow Lab', color: '#C7325C' }} type="leader" audience="public" status="live" dates="1–30 Nov" daysLeft={15}
goal="Top 10 by delivered sales" reward="EGP 1,000 each" top={[{ id: 101, seed: 2, name: 'Nour Hassan', sales: '58200.00' }, { id: 102, seed: 1, name: 'Sara Ali', sales: '31900.00' }, { id: 103, seed: 6, name: 'Hana Rami', sales: '31900.00' }]}
joined={64} people={[{ id: 1, name: 'Nour Hassan' }, { id: 2, name: 'Sara Ali' }]} held="10000.00" onOpen={() => {}} money={{ decimals: 'auto' }} />
</div>
);
}Live challenges in a grid
A leaderboard (raspberry band, the top 3 so far) and two targets (lime band, who hit the goal); the time left turns raspberry at 3 days or fewer. rewardNote puts any node in the reward chip (here the gift's stock pill). Lay cards in kit-prc-grid: three columns, two under 1240px, one on phones.
Code
import { PrChallengeCard, PrStatusPill } from '@ergasti/bricks';
const PEOPLE = ['Nour Hassan', 'Sara Ali', 'Hana Rami', 'Youssef Adel'].map((name, i) => ({ id: i + 1, name }));
const TOP = [{ id: 1, name: 'Nour Hassan', sales: '58200.00' }, { id: 2, name: 'Sara Ali', sales: '31900.00' }, { id: 3, name: 'Hana Rami', sales: '31900.00' }];
const GLOW = { id: 'glow', name: 'Glow Lab', color: '#C7325C' };
const MIRA = { id: 'mira', name: 'Mira Beauty', color: '#5B3BB0' };
const KEMET = { id: 'kemet', name: 'Kemet Home', color: '#3D5A10' };
function Live() {
return (
<div className="kit-prc-grid">
<PrChallengeCard name="Winter top 10" type="leader" audience="public" brand={GLOW} status="live" dates="1–30 Nov" daysLeft={15} timeProgress={50} goal="Top 10 by delivered sales" reward="EGP 1,000 each" top={TOP} joined={64} people={PEOPLE} held="10000.00" onOpen={() => {}} />
<PrChallengeCard name="Sell 20 in November" type="target" audience="brand" brand={MIRA} status="live" dates="1–30 Nov" daysLeft={15} timeProgress={50} goal="20 delivered orders" reward="Serum gift set" rewardKind="gift" rewardNote={<PrStatusPill status="gift_out" />} hit={9} joined={23} people={PEOPLE} held="7800.00" onOpen={() => {}} />
<PrChallengeCard name="Weekend sprint" type="target" audience="brand" brand={KEMET} status="live" dates="14–16 Nov" daysLeft={1} timeProgress={66} goal="EGP 5,000 delivered sales" reward="EGP 300 each" hit={7} joined={18} people={PEOPLE} held="6000.00" onOpen={() => {}} />
</div>
);
}Before, after and empty
Not live, the band is grey: upcoming says "Starts soon" with an empty time bar, settling counts the orders still on the way, ended says so. A leaderboard with no sales yet says the board shows once creators sell; nobody joined reads "No one yet". Without onOpen the name is plain text (the last card).
Code
import { PrChallengeCard } from '@ergasti/bricks';
const PEOPLE = ['Nour Hassan', 'Sara Ali', 'Hana Rami', 'Youssef Adel'].map((name, i) => ({ id: i + 1, name }));
const TOP = [{ id: 1, name: 'Nour Hassan', sales: '58200.00' }, { id: 2, name: 'Sara Ali', sales: '31900.00' }, { id: 3, name: 'Hana Rami', sales: '31900.00' }];
const GLOW = { id: 'glow', name: 'Glow Lab', color: '#C7325C' };
function States() {
return (
<div className="kit-prc-grid">
<PrChallengeCard name="December glow" type="leader" audience="public" brand={GLOW} status="upcoming" dates="1–31 Dec" goal="Top 5 by delivered orders" reward="EGP 2,000 each" joined={0} held="10000.00" onOpen={() => {}} />
<PrChallengeCard name="Double commission week" type="boost" audience="public" brand={{ id: 'all', name: 'All brands · TRNDR-wide', color: '#14151A' }} status="upcoming" dates="20–26 Nov" goal="Every delivered sale" reward="×2 commission · paid by TRNDR" joined={0} held="0.00" onOpen={() => {}} />
<PrChallengeCard name="November push" type="target" audience="brand" brand={{ id: 'nile', name: 'Nile Threads', color: '#2C45A6' }} status="settling" ordersOnTheWay={6} dates="1–14 Nov" goal="15 delivered orders" reward="EGP 500 each" hit={12} joined={31} people={PEOPLE} held="5000.00" onOpen={() => {}} />
<PrChallengeCard name="October top 10" type="leader" audience="public" brand={GLOW} status="ended" dates="1–31 Oct" goal="Top 10 by delivered sales" reward="EGP 1,000 each" top={TOP} joined={52} people={PEOPLE} held="10000.00" onOpen={() => {}} />
<PrChallengeCard name="Winter top 10" type="leader" audience="public" brand={GLOW} status="live" dates="1–30 Nov" daysLeft={20} timeProgress={10} goal="Top 10 by delivered sales" reward="EGP 1,000 each" joined={3} people={PEOPLE} held="10000.00" />
</div>
);
}In Arabic
The band, time, labels and footer read in Arabic and the bars fill from the right; names stay in their own script.
Code
import { PrChallengeCard } from '@ergasti/bricks';
const PEOPLE = ['Nour Hassan', 'Sara Ali', 'Hana Rami', 'Youssef Adel'].map((name, i) => ({ id: i + 1, name }));
const KEMET = { id: 'kemet', name: 'Kemet Home', color: '#3D5A10' };
function Arabic() {
return (
<div dir="rtl" style={{ maxWidth: 365, display: 'flex' }}>
<PrChallengeCard name="Weekend sprint" type="target" audience="brand" brand={KEMET} status="live" dates="14–16 Nov" daysLeft={1} timeProgress={66} goal="EGP 5,000 delivered sales" reward="EGP 300 each" hit={7} joined={18} people={PEOPLE} held="6000.00" onOpen={() => {}} language="ar" />
</div>
);
}Money display
The card's sales and budget held use the prChallengeCard.figures money slot (default "EGP 10,000.00"). An app changes it everywhere with BricksProvider moneyFor (here cents only when they are not zero, "EGP 10,000"); a card's own money prop wins over both.
Code
import { BricksProvider, PrChallengeCard } from '@ergasti/bricks';
const PEOPLE = ['Nour Hassan', 'Sara Ali', 'Hana Rami', 'Youssef Adel'].map((name, i) => ({ id: i + 1, name }));
const TOP = [{ id: 1, name: 'Nour Hassan', sales: '58200.00' }, { id: 2, name: 'Sara Ali', sales: '31900.00' }, { id: 3, name: 'Hana Rami', sales: '31900.00' }];
const GLOW = { id: 'glow', name: 'Glow Lab', color: '#C7325C' };
function MoneyDisplay() {
return (
<BricksProvider moneyFor={{ 'prChallengeCard.figures': { decimals: 'auto' } }}>
<div style={{ maxWidth: 365, display: 'flex' }}>
<PrChallengeCard name="Winter top 10" type="leader" audience="public" brand={GLOW} status="live" dates="1–30 Nov" daysLeft={15} timeProgress={50} goal="Top 10 by delivered sales" reward="EGP 1,000 each" top={TOP} joined={64} people={PEOPLE} held="10000.00" onOpen={() => {}} />
</div>
</BricksProvider>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prChallengeCard, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
type.leader | Leaderboard | لوحة ترتيب |
type.target | Target | هدف |
type.boost | Commission boost | زيادة العمولة |
audience.public | Public | عام |
audience.brand | Brand affiliates | المشتركين في البراند |
daysLeft | {s} days left | فاضل {s} يوم |
startsSoon | Starts soon | هيبدأ قريب |
onTheWay | {s} orders on the way | {s} طلب في السكة |
ended | Ended | خلص |
top3 | Top 3 now | أعلى 3 دلوقتي |
noBoard | The leaderboard shows once creators start selling. | لوحة الترتيب بتظهر لما صنّاع المحتوى يبدأوا يبيعوا. |
hitGoal | Hit the goal | وصلوا للهدف |
hitOf | [object Object] | [object Object] |
noGifts | No gifts left | الهدايا خلصت |
joined | joined | اشتركوا |
nobody | No one yet | لسه محدش |
held | held | محجوز |
goal | Goal | الهدف |
reward | Reward | المكافأة |
Design guidance
How the BRICKS design system uses PrChallengeCard. Written in docs/content/components/PrChallengeCard.md; the props above are read from the code, which wins where the two disagree.
The PR Challenges tab's challenge card: a tinted band with type, audience and status, the name and brand, dates with time left and a thin time bar, goal and reward chips, the top three now (leaderboard) or how many hit the goal (target), and a footer with faces, joined and the budget held; use it in the challenges grid.
It is the v3 PR mock's chCard. The name is the card's one button and covers the card, so the whole card opens the challenge; the money "?" notes stay their own buttons above it. Cards sit in kit-prc-grid (3, then 2, then 1 column).
Anatomy
- Card (
<article class="kit-pr-chc">, labelled by the name): radius--r-lg, 1px--line, lifts 2px on hover; focus ring when the name button is focused. - Band (
.kit-pr-chc-band--{tone}): a 34px icon (trophy / target / cash), "Leaderboard · Public", and aPrStatusPill. Live leaderboard: raspberry; live target/boost: lime; otherwise mute. - Name (
h3, a button withonOpen) and brand (xsBrandAvatar+ name). - Time: dates and "15 days left" (raspberry when ≤ 3), "Starts soon", "6 orders on the way" or "Ended"; a thin ink bar (
timeProgress). - Chips: goal (target icon) and reward (cash or gift icon), with "No gifts left" or
rewardNote. - Leaderboard: "Top 3 now" (
MoneyNote), three rows with medal, avatar, name and sales; none yet: "The leaderboard shows once creators start selling." Target: "Hit the goal", "7 of 18 creators", %, a bar. - Footer:
AvatarStack(up to 4), "64 joined" (or "No one yet") · "EGP 10,000.00 held" · arrow.
Variants
| Prop | Value | Look |
|---|---|---|
type | 'leader' | Trophy, top three. |
type | 'target' | Target, hit-the-goal bar. |
type | 'boost' | Cash icon, no ranking section. |
audience | 'public' / 'brand' | "Public" / "Brand affiliates". |
status | 'live', 'upcoming', 'settling', 'ended' | Band tone, time line, pill. |
rewardKind | 'cash' (default) / 'gift' | Reward icon. |
States
| State | How |
|---|---|
| Live, ending soon | daysLeft ≤ 3: raspberry "1 day left". |
| Upcoming | Time bar 0, "Starts soon". |
| Settling | ordersOnTheWay: "6 orders on the way". |
| Ended | "Ended", bar full. |
| Gifts out | noGiftsLeft: red "No gifts left" pill in the reward chip. |
| Nobody joined | joined={0}: "No one yet". |
| Read-only | no onOpen: name is plain text. |
| Hover / focus | Lift / card focus ring. |
Types
StackBrand (brand): { id, name, color? }. PrChallengeLeader (top): { id, name, avatarUrl?, sales, seed? }.
Usage
import { PrChallengeCard } from '@ergasti/bricks';
const faces = [{ id: 1, name: 'Nour Hassan' }, { id: 2, name: 'Sara Ali' }, { id: 3, name: 'Hana Rami' }, { id: 4, name: 'Youssef Adel' }];
export function ChallengesGrid({ openChallenge }: { openChallenge: (id: string) => void }) {
return (
<div className="kit-prc-grid">
<PrChallengeCard
name="Winter top 10" brand={{ id: 'glow', name: 'Glow Lab', color: '#C7325C' }}
type="leader" audience="public" status="live" dates="1–30 Nov" daysLeft={15}
goal="Top 10 by delivered sales" reward="EGP 1,000 each"
top={[{ id: 1, name: 'Nour Hassan', sales: '58200.00' }, { id: 2, name: 'Sara Ali', sales: '31900.00' }, { id: 3, name: 'Hana Rami', sales: '31900.00' }]}
joined={64} people={faces} held="10000.00" onOpen={() => openChallenge('winter-top-10')}
/>
<PrChallengeCard
name="Weekend sprint" brand={{ id: 'kemet', name: 'Kemet Home', color: '#3D5A10' }}
type="target" audience="brand" status="live" dates="28–30 Nov" daysLeft={1}
goal="EGP 5,000 delivered sales" reward="EGP 300 each" hit={7} joined={18} held="6000.00"
onOpen={() => openChallenge('weekend-sprint')}
/>
</div>
);
}Where it appears
- PR Portal › Affiliate programs › Challenges (grid view) and a brand's challenges. Screens: PR · Challenges, PR · A brand's campaign.
Guidelines
Do
- Pass
daysLeftandordersOnTheWayfrom the server. - Keep goal and reward short; they sit in chips.
- On an ended leaderboard pass
labels={{ top3: 'Final top 3' }}: the default list label stays "Top 3 now" whatever the status.
Don't
- Don't put other buttons in the card besides the money notes (the name covers it).
- Don't use it for a list of many; use
challengeColumnsin aDataTable.
RTL and Arabic
- Band, chips and footer mirror; the arrow flips; names are
<bdi>. "لوحة ترتيب · عام", "فاضل 15 يوم".
Tokens
--line, --card, --r-lg, --rasp-50, --rasp-ink, --lime-50, --olive, --soft, --ink-2, --focus-ring.
Accessibility
<article aria-labelledby>the name; the name is the single button; icons arearia-hidden.- Goal and reward chips carry hidden "Goal:" / "Reward:" labels; bars are decorative (the numbers are written).
Found in the source
- ARIA attributes set:
aria-labelledby,aria-hidden.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
ChallengeStatusFilter,challengeColumns: the table view.ChallengeSummary: the builder review.ChallengeCard(blocks): the brand dashboard's challenge card.
See also: Avatar · AvatarStack · Money · MoneyNote · Pill · useLanguage · BrandAvatar · PrIcon · PrStatusPill · Card · BricksProvider · BrandRequestCard · BuilderStepCard · ChallengeAudienceFields
Source
src/pr/challenges/PrChallengeCard.tsx (line 117) on GitHub.