Skip to Content
BBRICKSv0.7.4
PR PortalChallenges

SummaryLine

A <div><dt/><dd/></div> row (the mock's .kv): put it in a SummarySection (a <dl>).

import { SummaryLine } 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

Design guidance

How the BRICKS design system uses SummaryLine. Written in docs/content/components/SummaryLine.md; the props above are read from the code, which wins where the two disagree.

One line of a summary: a label and a value, or a money amount with its "?" note; use it inside a SummarySection (a <dl>).

It is the mock's .kv row in the PR builder summary and side cards. With amount + figure the label becomes a MoneyNote term and the amount is formatted through the challengeSummary.figures slot.

Anatomy

  1. Row (<div class="kit-pr-sumline">): <dt> label (muted) and <dd> value (bold, end-aligned, tabular).
  2. Hint (optional): a muted <small> under the value, or on the value's line with inlineHint.

Variants

PropsLook
valuePlain value ("Glow serum set").
amount + figureMoney with the label as a "?" term ("EGP 1,000.00").
hint"each" under the value.
inlineHint"EGP 1,000.00 each" as one bold run (the v3 builder).
tone="bad" / "ok"Red / green value.

States

Static.

Usage

import { SummaryLine, SummarySection } from '@ergasti/bricks';

export function RewardLines() {
  return (
    <SummarySection title="Reward">
      <SummaryLine label="Per winner" amount="1000.00" figure="challenge_commission" hint="each" />
      <SummaryLine label="Gift" value="Glow serum set" />
      <SummaryLine label="Wallet after hold" amount="-6610.00" figure="wallet_available" tone="bad" />
    </SummarySection>
  );
}

Where it appears

Guidelines

Do

  • Use amount + figure for every money value so it has its note.

Don't

  • Don't pass both value and amount (the types forbid it).
  • Don't use it outside a <dl>.

RTL and Arabic

  • Label right, value left; money follows the provider's Arabic format.

Tokens

--ink-3, --bad, --ok.

Accessibility

  • <dt>/<dd> pairs inside the section's <dl>; colour tones are backed by the sign or words.

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.

See also: Button · Money · useBricks · useLanguage · BrandAvatar · PrIcon · PrStatusPill · Card · BrandRequestCard · BuilderStepCard · ChallengeAudienceFields

Source

src/pr/challenges/ChallengeSummary.tsx (line 78) on GitHub.

On this page