Skip to Content
BBRICKSv0.7.4
PR PortalBrands

BrandGiftStock

The brand page's gift stock (v3 mock, inside the Gift rules card under a rule): an uppercase heading with the "Stock requests →" link, then units left of the confirmed total, delivered and not delivered yet. Only units PR counted and confirmed are stock (a brand's claim is not). Out of gifts (some confirmed, none left) adds the red "No gifts left" pill and the note that campaigns stay live.

import { BrandGiftStock } from '@ergasti/bricks';

Examples

A brand's gift stock, under its gift rules

Only units PR counted and confirmed are stock. Out of gifts (some confirmed, none left) adds "No gifts left" and the note that campaigns stay live.

Code
import { BrandGiftStock, Card } from '@ergasti/bricks';

function Stock() {
  return (
    <div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))' }}>
      <Card><BrandGiftStock left={42} total={100} delivered={38} notDelivered={20} onOpenRequests={() => {}} /></Card>
      <Card><BrandGiftStock left={0} total={30} delivered={24} notDelivered={6} onOpenRequests={() => {}} /></Card>
    </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 prBrandGiftStock, or with the component's own prop where it has one. A {name} is a value the component fills in.

prBrandGiftStock
KeyEnglishArabic
titleGift stock (confirmed units)مخزون الهدايا (القطع المتأكدة)
requestsStock requests →طلبات المخزون ←
leftUnits leftالقطع الفاضلة
deliveredDeliveredاتسلّمت
notDeliveredNot delivered yetلسه ماتسلّمتش
outNo gifts leftمفيش هدايا فاضلة
outNoteCampaigns stay live and creators can still join. Only the gift shows "No gifts left" until the brand sends more stock and you confirm it.الحملات فاضلة شغالة وصنّاع المحتوى يقدروا ينضموا. الهدية بس هي اللي بيبان عليها "مفيش هدايا فاضلة" لحد ما البراند يبعت مخزون تاني وإنت تأكده.

Design guidance

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

A brand's confirmed gift stock on its PR page: an uppercase heading with "Stock requests →", then units left of the confirmed total, delivered and not delivered yet, and a red "No gifts left" warning when it runs out; use it inside the brand page's Gift rules card.

It is the v3 PR mock's gift stock block, under a rule in the Gift rules card. Only units PR counted and confirmed are stock (a brand's claim is not). Out of gifts (some confirmed, none left) adds the pill and the note that campaigns stay live.

Anatomy

  1. Section (.kit-pr-gstock, labelled): 14px top padding over a --line rule.
  2. Heading: QueueHeader "Gift stock (confirmed units)" with the "Stock requests →" link (onOpenRequests).
  3. Pill (out only): red "No gifts left".
  4. Figures (FigureRow): Units left "42 / 100", Delivered 38, Not delivered yet 20.
  5. Note (out only): "Campaigns stay live and creators can still join. Only the gift shows "No gifts left" until the brand sends more stock and you confirm it."

Variants

CaseConditionLook
In stockleft > 0Figures.
Out of giftstotal > 0 && left <= 0Pill, figures, note.
No stock yettotal === 0"0 / 0", no pill (not "out").

States

As above; without onOpenRequests there is no link.

Usage

import { BrandGiftStock, Card, SettingRow, Switch } from '@ergasti/bricks';

export function GiftRulesCard({ openRequests }: { openRequests: () => void }) {
  return (
    <Card>
      <Card.Header title="Gift rules" sub="Only PR can change these. The brand sees them read-only." />
      <SettingRow title="One gift per challenge" control={<Switch checked onChange={() => {}} label="One gift per challenge" />} />
      <BrandGiftStock left={42} total={100} delivered={38} notDelivered={20} onOpenRequests={openRequests} />
    </Card>
  );
}

Where it appears

  • PR Portal › Brands › Brand detail › Gift rules card, bottom. Screen: PR · Brand.

Guidelines

Do

  • Count only confirmed units in left and total.
  • Link to the brand's stock requests.

Don't

  • Don't show "No gifts left" for a brand that never sent stock.

RTL and Arabic

  • "مخزون الهدايا (القطع المتأكدة)", "طلبات المخزون ←"; numbers formatted per language.

Tokens

--line; QueueHeader, Pill, FigureRow tokens.

Accessibility

  • A <section> named by its title ("Gift stock (confirmed units)"); the QueueHeader inside draws the same words as an <h3>, so the region and heading agree.
  • The figures are a FigureRow <dl>: "Units left" / "42 / 100", "Delivered" / "38", "Not delivered yet" / "20"; values are isolated (<bdi>), so "42 / 100" never reverses in Arabic. "42 / 100" is read as "42 slash 100": the label says what it means.
  • "Stock requests →" is a real <button>; its arrow is part of the label string, so some screen readers read "right arrow". Override the words with labels={{ requests: 'Stock requests' }} if that matters to your users.
  • "No gifts left" is a static pill and the out-of-stock note is plain text: neither is a live region, so a change while the page is open is not announced. The pill states it in words, not colour alone.

Found in the source

  • ARIA attributes set: aria-label.
  • Its tests cover: “Arabic, RTL, and a labels override”.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Pill · useLanguage · QueueHeader · FigureRow · Card · AdjustWalletDialog · BrandAvatar · BrandCell

Source

src/pr/brand/BrandGiftStock.tsx (line 53) on GitHub.

On this page