SummarySection
A titled group of SummaryLines with an "Edit" link back to its step; with no title, the lines alone (a <dl>).
import { SummarySection } from '@ergasti/bricks';Examples
Builder summary
The last step of the challenge builder: what it is, who can join, the rewards, the gifts it needs, the budget it holds and warnings that link back to the step to fix. mode is launch or approve.
Code
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function Summary() {
return (
<div style={{ maxWidth: 440 }}>
<ChallengeSummary
name="Winter top 10" brand={brands.glow} status="upcoming" dates="1 Dec → 31 Dec" goal="Top 10 by delivered sales"
eligibility={{ audience: 'public', groups: [], tiers: ['established', 'elite'], niches: ['Beauty', 'Skincare'] }}
rewards={[{ key: 'per', label: 'Per winner', amount: '1000.00', figure: 'challenge_commission', hint: 'each' }, { key: 'gift', label: 'Gift', value: 'Glow serum set' }]}
gifts={[{ id: 1, name: 'Glow serum set', left: 4, needed: 10 }]}
budget={{ hold: '10000.00', available: '43390.00' }}
warnings={[{ id: 'gift', text: 'Only 4 gift sets left for 10 winners.', step: 'reward' }, { id: 'dates', text: 'Starts in 14 days: creators can join once it starts.' }]}
steps={{ basics: '1', goal: '2', join: '3', reward: '4' }} onEditStep={() => {}} onPrimary={() => {}} onSaveDraft={() => {}}
/>
</div>
);
}The parts
A summary is sections made of lines; use them for your own review screens.
Code
import { Card, SummaryLine, SummarySection } from '@ergasti/bricks';
function Parts() {
return (
<div style={{ maxWidth: 440 }}>
<Card>
<SummarySection title="Reward" onEdit={() => {}} editLabel="Edit the reward step">
<SummaryLine label="Per winner" amount="1000.00" figure="challenge_commission" hint="each" />
<SummaryLine label="Gift" value="Glow serum set" />
<SummaryLine label="Budget on hold" value="EGP 10,000.00" tone="bad" />
</SummarySection>
</Card>
</div>
);
}Approve a brand's request
mode="approve" is a brand's request under review: the primary reads "Approve and launch" and onReject adds Reject (the app opens its ReasonDialog). Approving sets pending, which locks both buttons while the app saves.
Code
import { useState } from 'react';
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function Approve() {
const [pending, setPending] = useState(false);
return (
<div style={{ maxWidth: 440 }}>
<ChallengeSummary
mode="approve" pending={pending}
name="Weekend sprint" brand={brands.mira} status="needs_review" dates="6 Dec → 8 Dec" goal="20 orders · max 30"
eligibility={{ audience: 'brand', groups: ['Top sellers'] }}
rewards={[{ key: 'bonus', label: 'Bonus at 20 orders', amount: '500.00', figure: 'challenge_commission' }]}
budget={{ hold: '5000.00', available: '5200.00' }}
onPrimary={() => { setPending(true); window.setTimeout(() => setPending(false), 1500); }} onReject={() => {}}
/>
</div>
);
}Cannot launch yet
A bad warning disables the primary action on its own, and so does a wallet that cannot hold the budget (it adds "Not enough in the wallet…" itself); canSubmit={false} does the same for a check the app makes, and canSubmit overrides all of them.
Code
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function Blocked() {
return (
<div style={{ maxWidth: 440 }}>
<ChallengeSummary
canSubmit={false}
name="Sell 30 in December" brand={brands.nile} dates="1 Dec → 31 Dec" goal="30 orders"
eligibility={{ audience: 'public' }}
rewards={[{ key: 'per', label: 'Per creator', amount: '750.00', figure: 'challenge_commission' }]}
budget={{ hold: '22500.00', available: '9100.00' }}
warnings={[{ id: 'budget', tone: 'bad', text: 'The wallet cannot cover the hold: top up EGP 13,400 first.' }]}
onPrimary={() => {}} onSaveDraft={() => {}}
/>
</div>
);
}Flat summary
The v3 builder's sticky card (layout="flat"): plain lines, the budget, red lines for what blocks the launch; payer="trndr" for a TRNDR-wide challenge.
Code
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function Flat() {
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 420 }}>
<ChallengeSummary layout="flat" name="" brand={brands.glow} status="upcoming" dates="1 Dec → 31 Dec" goal="20 orders · max 10" eligibility={{ audience: 'public' }}
rewards={[{ key: 'r', label: 'Reward', value: 'Serum gift set' }]} budget={{ hold: '6500.00', available: '43390.00' }} money={{ decimals: 'auto' }}
warnings={[{ id: 'n', text: 'Add a name in step 1.', tone: 'bad' }]} onPrimary={() => {}} onSaveDraft={() => {}} />
<ChallengeSummary layout="flat" payer="trndr" name="Black Friday 50" brand={brands.glow} status="upcoming" dates="24 Nov → 30 Nov" goal="50 orders · max 20" eligibility={{ audience: 'public' }}
rewards={[{ key: 'r', label: 'Reward', value: 'EGP 1,000 each' }]} budget={{ hold: '20000.00' }} money={{ decimals: 'auto' }} onPrimary={() => {}} />
</div>
);
}Flat, as in the mock
flatDensity="mock" gives the flat card the v3 builder's spacing: 16px under the heading, 12px warning lines with room above and below, and a 46px launch button. A reward line with inlineHint keeps its hint in the same bold run ("EGP 1,000 each") instead of a muted line under the amount. Both default to 0.4.0's look.
Code
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function FlatMock() {
return (
<div style={{ maxWidth: 420 }}>
<ChallengeSummary layout="flat" flatDensity="mock" name="" brand={brands.glow} status="upcoming" dates="1 Dec → 31 Dec" goal="Top 10 by sales" eligibility={{ audience: 'public' }}
rewards={[{ key: 'per', label: 'Reward', amount: '1000.00', figure: 'challenge_commission', hint: 'each', inlineHint: true }]} budget={{ hold: '10000.00', available: '43390.00' }} money={{ decimals: 'auto' }}
warnings={[{ id: 'n', text: 'Add a name in step 1.', tone: 'bad' }]} onPrimary={() => {}} onSaveDraft={() => {}} />
</div>
);
}Paused, or short of money
paused says the brand's program is paused and stops the launch. A wallet that cannot hold the budget warns and stops it too; onAskTopUp adds "Ask {brand} to top up" under that warning, so PR can ask from the summary. Both work in either layout.
Code
import { useState } from 'react';
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function PausedAndShortWallet() {
const [asked, setAsked] = useState(false);
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 420 }}>
<ChallengeSummary layout="flat" paused name="Ramadan glow" brand={brands.glow} status="upcoming" dates="1 Mar → 30 Mar" goal="20 orders · max 10" eligibility={{ audience: 'public' }}
rewards={[{ key: 'r', label: 'Reward', value: 'Serum gift set' }]} budget={{ hold: '6500.00', available: '43390.00' }} money={{ decimals: 'auto' }} onPrimary={() => {}} onSaveDraft={() => {}} />
<ChallengeSummary layout="flat" name="Sell 30 in December" brand={brands.nile} status="upcoming" dates="1 Dec → 31 Dec" goal="30 orders" eligibility={{ audience: 'public' }}
rewards={[{ key: 'per', label: 'Per creator', amount: '750.00', figure: 'challenge_commission' }]} budget={{ hold: '22500.00', available: '9100.00' }} money={{ decimals: 'auto' }}
onAskTopUp={() => setAsked(true)} onPrimary={() => {}} onSaveDraft={() => {}} />
{asked && <small>Top-up request sent to Nile Threads.</small>}
</div>
);
}Lines without a section title
A SummarySection with no title draws its lines alone, as a flat key-value list: use it under your own heading.
Code
import { Card, SummaryLine, SummarySection } from '@ergasti/bricks';
function UntitledSection() {
return (
<div style={{ maxWidth: 440 }}>
<Card>
<SummarySection>
<SummaryLine label="Brand" value="Glow Lab" />
<SummaryLine label="Dates" value="1 Dec → 31 Dec" />
<SummaryLine label="Per winner" amount="1000.00" figure="challenge_commission" hint="each" />
</SummarySection>
</Card>
</div>
);
}A launch that failed
error with onRetry: a red alert with Try again above the actions (true: "Couldn’t launch the challenge.").
Code (not run)
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function LaunchFailed() {
return (
<div style={{ maxWidth: 440 }}>
<ChallengeSummary layout="flat" flatDensity="mock" name="Winter top 10" brand={brands.glow} status="upcoming" dates="1 Dec → 31 Dec" goal="Top 10 by sales" eligibility={{ audience: 'public' }}
rewards={[{ key: 'per', label: 'Reward', amount: '1000.00', figure: 'challenge_commission', hint: 'each', inlineHint: true }]} budget={{ hold: '10000.00', available: '43390.00' }}
onPrimary={() => {}} onSaveDraft={() => {}} error onRetry={() => {}} money={{ decimals: 'auto' }} />
</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 prChallengeSummary, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
summary | Summary | الملخص |
edit | Edit | عدّل |
editStep | Edit {s} | عدّل {s} |
basics | Basics | الأساسيات |
brand | Brand | البراند |
name | Name | الاسم |
dates | Dates | التواريخ |
goal | Type | النوع |
join | Who can join | مين يقدر يشترك |
reward | Reward | الجايزة |
gifts | Gifts | الهدايا |
budget | Budget | الميزانية |
public | Public: any approved creator | عام: أي صانع محتوى متقبل |
affiliates | {b} affiliates only | المشتركين في {b} بس |
groups | Groups | المجموعات |
tiers | Tiers | المستويات |
niches | Niches | المجالات |
anyone | Anyone | أي حد |
stock | {n} left | فاضل {n} |
noStock | No gifts left | مفيش هدايا فاضلة |
short | {left} left, {need} needed | فاضل {left} ومحتاجين {need} |
hold | Budget to hold | الميزانية اللي هتتحجز |
has | {b} has | اللي عند {b} |
after | Left after hold | الباقي بعد الحجز |
used | {p}% of the wallet | {p}% من المحفظة |
checks | Before you launch | قبل ما تطلق التحدي |
allGood | Everything checks out. | كله تمام. |
blocking | must be fixed | لازم يتصلّح |
unnamed | — | — |
sep | , | ، |
launch | Launch challenge | اطلق التحدي |
approve | Approve and launch | وافق واطلق |
draft | Save as draft | احفظ كمسودة |
reject | Reject request | ارفض الطلب |
working | Working… | لحظة… |
publicShort | Public | عام |
affiliatesShort | Brand affiliates | المشتركين في البراند |
paidBy | Paid by | بيدفع |
trndr | TRNDR | TRNDR |
trndrBudget | TRNDR budget | ميزانية TRNDR |
noHold | Nothing is held from brand wallets. | مفيش حاجة بتتحجز من محافظ البراندات. |
shortWallet | Not enough in the wallet. We only launch when the full budget can be held. | الفلوس اللي في المحفظة مش كفاية. مبنطلقش التحدي غير لما الميزانية كلها تتحجز. |
askTopUp | Ask {b} to top up | اطلب من {b} يشحن |
paused | {b}’s program is paused. | برنامج {b} متوقف. |
error | Couldn’t launch the challenge. | مقدرناش نطلق التحدي. |
retry | Try again | جرّب تاني |
Design guidance
How the BRICKS design system uses SummarySection. Written in docs/content/components/SummarySection.md; the props above are read from the code, which wins where the two disagree.
A titled group of SummaryLines with an "Edit" link back to its builder step, or, without a title, the lines alone as a flat list; use it to build summary cards in the PR Portal.
It is the building block of ChallengeSummary (Basics, Type, Who can join, Reward, Budget). Without title it renders just the <dl>: the v3 mock's plain cards (Budget, a wallet, a brand request's side cards).
Anatomy
- Section (
<section class="kit-pr-sumsec">, labelled by its title). - Head (
.kit-pr-sumsec-h): theh3(small uppercase) and an "Edit" link (withonEdit). - Lines (
<dl class="kit-pr-kv">): the children.
Variants
| Props | Look |
|---|---|
title + onEdit | Heading with "Edit" (named "Edit {step}"). |
title only | Heading, no link (story NoEdit). |
no title | The <dl> alone. |
States
Static; the link has hover and focus styles.
Usage
import { Card, SummaryLine, SummarySection } from '@ergasti/bricks';
export function Basics({ goToStep }: { goToStep: (step: string) => void }) {
return (
<SummarySection title="Basics" onEdit={() => goToStep('basics')}>
<SummaryLine label="Name" value="Winter top 10" />
<SummaryLine label="Dates" value="1 Dec → 31 Dec" />
</SummarySection>
);
}
// A request page side card: the lines alone
export function WalletSideCard() {
return (
<Card title="Glow Lab wallet">
<SummarySection>
<SummaryLine label="Available" amount="43390.00" figure="wallet_available" />
<SummaryLine label="Held for orders" amount="18450.00" figure="wallet_held" />
</SummarySection>
</Card>
);
}Where it appears
- PR Portal › Challenge builder summary. Screens:
PrBuilder*. - PR Portal › a brand's request side cards (no title). Screen: PR · Brand request.
Guidelines
Do
- Link each section to the step that edits it.
Don't
- Don't nest sections.
RTL and Arabic
- "عدّل"; heading not uppercased in Arabic.
Tokens
--ink-3 (heading); link tokens.
Accessibility
- With a
title: a<section>labelled by its<h3>, so each part of the summary is a named region and a heading in the outline (the summary card's own title is theh2). - The "Edit" link is a
<button>whose accessible name is "Edit {step}" ("Edit Basics", fromeditLabelor a text title). The name starts with the visible word, so speech users can say "Edit"; passeditLabelwhen the title is not plain text. - Lines are a
<dl>: eachSummaryLineis a<dt>/<dd>pair, so a screen reader pairs label and value. A money label is aMoneyNoteterm, a button that opens the figure's note. - Without a
titleit is only the<dl>, with no heading or region: give the surrounding card a title so the list has context.
Found in the source
- Roles in the markup:
status,img,group. - ARIA attributes set:
aria-labelledby,aria-label,aria-busy.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
See also: Button · Money · MoneyNote · useBricks · useLanguage · BrandAvatar · PrIcon · PrStatusPill · Card · BrandRequestCard · BuilderStepCard · ChallengeAudienceFields
Source
src/pr/challenges/ChallengeSummary.tsx (line 100) on GitHub.