Skip to Content
BBRICKSv0.7.4
PR PortalChallenges

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.

Pinned to Arabic
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.

prChallengeCard
KeyEnglishArabic
type.leaderLeaderboardلوحة ترتيب
type.targetTargetهدف
type.boostCommission boostزيادة العمولة
audience.publicPublicعام
audience.brandBrand affiliatesالمشتركين في البراند
daysLeft{s} days leftفاضل {s} يوم
startsSoonStarts soonهيبدأ قريب
onTheWay{s} orders on the way{s} طلب في السكة
endedEndedخلص
top3Top 3 nowأعلى 3 دلوقتي
noBoardThe leaderboard shows once creators start selling.لوحة الترتيب بتظهر لما صنّاع المحتوى يبدأوا يبيعوا.
hitGoalHit the goalوصلوا للهدف
hitOf[object Object][object Object]
noGiftsNo gifts leftالهدايا خلصت
joinedjoinedاشتركوا
nobodyNo one yetلسه محدش
heldheldمحجوز
goalGoalالهدف
rewardRewardالمكافأة

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

  1. 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.
  2. Band (.kit-pr-chc-band--{tone}): a 34px icon (trophy / target / cash), "Leaderboard · Public", and a PrStatusPill. Live leaderboard: raspberry; live target/boost: lime; otherwise mute.
  3. Name (h3, a button with onOpen) and brand (xs BrandAvatar + name).
  4. Time: dates and "15 days left" (raspberry when ≤ 3), "Starts soon", "6 orders on the way" or "Ended"; a thin ink bar (timeProgress).
  5. Chips: goal (target icon) and reward (cash or gift icon), with "No gifts left" or rewardNote.
  6. 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.
  7. Footer: AvatarStack (up to 4), "64 joined" (or "No one yet") · "EGP 10,000.00 held" · arrow.

Variants

PropValueLook
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

StateHow
Live, ending soondaysLeft ≤ 3: raspberry "1 day left".
UpcomingTime bar 0, "Starts soon".
SettlingordersOnTheWay: "6 orders on the way".
Ended"Ended", bar full.
Gifts outnoGiftsLeft: red "No gifts left" pill in the reward chip.
Nobody joinedjoined={0}: "No one yet".
Read-onlyno onOpen: name is plain text.
Hover / focusLift / 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

Guidelines

Do

  • Pass daysLeft and ordersOnTheWay from 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 challengeColumns in a DataTable.

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 are aria-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.

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.

On this page