BonusCard
The Bonuses tab's card: a tinted head (the bonus and its rule), the closest creators' progress in lime pips, and "Open for everyone's progress →". One button: it opens the bonus drawer.
import { BonusCard } from '@ergasti/bricks';Examples
Bonus cards
A threshold bonus ("reach 20 orders → EGP 500") with the creators closest to it; the whole card opens the detail.
Code
import { BonusCard, useLanguage } from '@ergasti/bricks';
import { blocksData } from './sample-data';
function Cards() {
const language = useLanguage();
return (
<div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))' }}>
{blocksData.BONUSES.map((b) => <BonusCard key={b.title} title={b.title} rule={b.rule[language]} tone={b.tone} progress={b.progress} onOpen={() => {}} />)}
</div>
);
}Bonus detail
Everyone's progress toward the goal, with links to the creator and to the challenge.
Code
import { BonusDetail, useLanguage } from '@ergasti/bricks';
import { blocksData } from './sample-data';
function Detail() {
const language = useLanguage();
const b = blocksData.BONUSES[0];
return <div style={{ maxWidth: 400 }}><BonusDetail title={b.title} rule={b.rule[language]} tone="rasp" progress={b.progress} onOpenCreator={() => {}} onOpenChallenge={() => {}} /></div>;
}Fewer rows, and nobody started
rows sets how many of the closest creators the card shows (default 4); with an empty progress the card says nobody has started yet.
Code
import { BonusCard, useLanguage } from '@ergasti/bricks';
import { blocksData } from './sample-data';
function RowsAndEmpty() {
const language = useLanguage();
const b = blocksData.BONUSES[0];
return (
<div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))' }}>
<BonusCard title={b.title} rule={b.rule[language]} tone={b.tone} progress={b.progress} rows={2} onOpen={() => {}} />
<BonusCard title="Back to campus · 30 orders" rule={b.rule[language]} tone="lime" progress={[]} onOpen={() => {}} />
</div>
);
}A money goal, done by the server
For a sales bonus, display on each progress row shows formatted money in place of "value / goal", and done (from the server) adds "· Done" even when the rounded value is under the goal. Leave both out for a count goal: the card then shows "9 / 20" and works out Done itself.
Code
import { BonusCard, Money, useLanguage } from '@ergasti/bricks';
function MoneyGoal() {
const language = useLanguage();
const goal = '5000.00';
const rows = [
{ id: 9, name: 'Tarek Fathy', sales: '5000.00', done: true },
{ id: 2, name: 'Salma Hosny', sales: '3420.50', done: false },
{ id: 4, name: 'Karim Hosny', sales: '1234.00', done: false },
];
const progress = rows.map((r) => ({ id: r.id, name: r.name, value: Math.floor(Number(r.sales)), goal: Number(goal), done: r.done,
display: <><Money value={r.sales} /> / <Money value={goal} /></> }));
return (
<div style={{ maxWidth: 420 }}>
<BonusCard title={language === 'ar' ? 'جلو الشتا · مبيعات 5,000 ج.م' : 'Winter glow · EGP 5,000 in sales'} rule={language === 'ar' ? 'بيع بـ 5,000 ج.م في التحدي ← مكافأة 500 ج.م' : 'Sell EGP 5,000 in the challenge → EGP 500 bonus'}
tone="lime" progress={progress} 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 bonusCard, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
open | Open for everyone’s progress → | افتح عشان تشوف تقدّم الكل ← |
everyone | Everyone’s progress | تقدّم الكل |
openChallenge | Open the challenge | افتح التحدي |
empty | Nobody has started yet. | لسه محدش بدأ. |
Design guidance
How the BRICKS design system uses BonusCard. Written in docs/content/components/BonusCard.md; the props above are read from the code, which wins where the two disagree.
A bonus card for Motivation › Bonuses: a tinted head with the bonus and its rule, the closest creators' progress as lime pip rows, and "Open for everyone's progress →"; the whole card opens the bonus drawer.
It is the bonuses tab card in the v3 brand mock ("Winter glow · 20 orders", "Reach 20 orders in the challenge → EGP 500 bonus"). Bonuses are set up by the TRNDR team; the brand watches who is close. Pass progress closest first; the card shows the first rows (default 4). For a money goal, the server sends the formatted display and done.
Anatomy
- Card: one
button.kit-blk-bcard, padding 22, 1px line,--r-lg, lifts on hover. - Head:
.kit-blk-bcard-h.kit-blk-tone--<tone>, min height 96, padding 20, radius--r-lg: title (16 / 600) and rule (12 / 700) at the bottom. - Progress rows:
ProgressRowper creator, lime pips, "9 / 20" ordisplay, "· Done" when done. - Footer: muted "Open for everyone's progress →".
Variants
| Prop | Values | When |
|---|---|---|
tone | 'lime' | 'rasp' | 'butter' | 'sky' | 'lilac' | Head tint (rasp live, sky ended in the mock data). |
rows | number (default 4) | How many creators. |
Progress display / done | money text / server flag | Sales goals ("EGP 1,234 / EGP 5,000"). |
States
| State | Trigger |
|---|---|
| Live | progress rows filling. |
| Ended | rule says so ("Ended · 9 creators earned the bonus"). |
| Done row | done: true, or value ≥ goal when done is left out. |
| No creators | progress=[]: head and footer only. |
| Hover / focus-visible | lift; 2px --rasp outline. |
Types
BonusProgress (progress): { id, name, value, goal, display?, done? }, closest first. BonusCopy (labels): open, everyone, openChallenge, empty.
Usage
// Brand › Motivation › Bonuses
<Banner tone="info" icon="motivation">Bonuses reward creators for reaching a goal. The TRNDR team sets them up; here you see who's close and who earned one.</Banner>
<div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))' }}>
{bonuses.map((b) => (
<BonusCard key={b.id} title={b.title} rule={b.rule[language]} tone={b.tone} progress={b.progress} onOpen={() => setOpen(b.id)} />
))}
</div>// A sales goal: the server formats the figures and says when it is done
<BonusCard title="Ramadan · EGP 5,000 in sales" rule="Sell EGP 5,000 → EGP 750 bonus" tone="lime" onOpen={open}
progress={[
{ id: 1, name: 'Laila Saeed', value: 1234, goal: 5000, display: 'EGP 1,234 / EGP 5,000', done: false },
{ id: 2, name: 'Karim Hosny', value: 4990, goal: 5000, display: 'EGP 4,990 / EGP 5,000', done: true },
]} />Where it appears
- Brand › Motivation › Bonuses › bonus cards (BrandMotivation).
Guidelines
Do
- Sort progress closest-to-goal first on the server.
- Let the server decide
donefor money goals.
Don't
- Don't nest buttons in the card; it is one button.
RTL and Arabic
- Mirrors; pips fill from the right; "←" in the Arabic footer "افتح عشان تشوف تقدّم الكل ←". Rule: "وصّل 20 طلب في التحدي ← مكافأة 500 ج.م".
Tokens
--card, --line, --r-lg, --ink, --rasp; tone pairs; ProgressRow lime pips (--chart-lime on --track).
Accessibility
- The card is one
<button>: its name is the title, rule, rows and footer. Keeprowssmall so it stays readable. - Pips are decorative; each row's text says the value.
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
BonusDetail(the drawer),ChallengeCard,ProgressRow.
See also: useLanguage · Money · ChallengeDetail · ChallengeRequestForm
Source
src/blocks/motivation/BonusCard.tsx (line 51) on GitHub.