Skip to Content
BBRICKSv0.7.4
BlocksGroups

GroupCommissionPill

The commission pill every group block shows: approved (ok), asked (warn), a rate the brand set (ok, "20% of sale"), mixed (mute, "Mixed"), else the standard rate (mute).

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

Examples

Group cards

A tone, the first members as an avatar stack, the group's sales and where its commission stands: standard, asked (waiting for TRNDR) or approved. The cards sit in an auto-fill grid with a NewCard last.

Code
import { GroupCard, NewCard } from '@ergasti/bricks';
import { blocksData } from './sample-data';

function Cards() {
  return (
    <div className="kit-cards" style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(min(100%, 280px), 1fr))', gap: 16 }}>
      {blocksData.GROUPS.map((g) => (
        <GroupCard key={g.id} name={g.name} tone={g.tone} members={g.members} commission={g.commission} sales={blocksData.groupSales(g.members)} onOpen={() => {}} />
      ))}
      <NewCard title="+ New group" sub="Pick the creators by hand" onClick={() => {}} />
    </div>
  );
}

Commission pill

The pill on its own, for your own group rows. It needs the group words (copy, with mixed for the "Mixed" state), since the pill is drawn outside a component that reads the provider. A set rate is said in the long words ("20% of sale"); language picks their language (default: the provider's).

Code
import { GroupCommissionPill } from '@ergasti/bricks';

function Pill() {
  const copy = { creators: (n: number) => `${n} creators`, standard: (rate: string) => `Standard ${rate}`, asked: (label: string) => `Asked: ${label}`, mixed: 'Mixed' };
  return (
    <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
      <GroupCommissionPill commission={{ state: 'standard' }} standardRate="15%" copy={copy} />
      <GroupCommissionPill commission={{ state: 'asked', label: 'EGP 30 per item' }} standardRate="15%" copy={copy} />
      <GroupCommissionPill commission={{ state: 'approved', label: '20% of sale' }} standardRate="15%" copy={copy} />
      <GroupCommissionPill commission={{ state: 'set', kind: 'per_item', value: '30' }} standardRate="15%" copy={copy} language="en" />
      <GroupCommissionPill commission={{ state: 'mixed' }} standardRate="15%" copy={copy} />
    </div>
  );
}

Another standard rate

standardRate is the program's standard rate in words, shown while the group has no special commission (default "15%").

Code
import { GroupCard } from '@ergasti/bricks';
import { blocksData } from './sample-data';

function StandardRate() {
  const g = blocksData.GROUPS[0];
  return <div style={{ maxWidth: 320 }}><GroupCard name={g.name} tone={g.tone} members={g.members} commission={{ state: 'standard' }} sales={blocksData.groupSales(g.members)} standardRate="10% of sale" onOpen={() => {}} /></div>;
}

Rates the brand sets itself

{ state: 'set', kind, value } is an ok pill in the long words, "20% of sale" or "EGP 30 per item" (label replaces them); { state: 'mixed' } says "Mixed". Without sales the card has no figure; memberCount counts beyond the faces sent.

Code
import { GroupCard } from '@ergasti/bricks';
import { blocksData } from './sample-data';

function SetAndMixed() {
  const g = blocksData.GROUPS[0];
  return (
    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(min(100%, 280px), 1fr))', gap: 16 }}>
      <GroupCard name={g.name} tone="lime" members={g.members} commission={{ state: 'set', kind: 'percent', value: '20' }} sales={blocksData.groupSales(g.members)} onOpen={() => {}} />
      <GroupCard name="TikTok first" tone="sky" members={g.members} commission={{ state: 'set', kind: 'per_item', value: '30' }} onOpen={() => {}} />
      <GroupCard name="New this month" tone="butter" members={g.members.slice(0, 3)} memberCount={12} commission={{ state: 'mixed' }} onOpen={() => {}} />
    </div>
  );
}

Props

Prop

Type

Design guidance

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

The pill that states a creator group's commission: the program's standard rate, a special rate asked of TRNDR (waiting), approved, a rate the brand set itself, or "Mixed"; use it wherever a group is shown.

Every group block draws it (GroupCard, GroupPanel). Its words come from a copy object (GroupCard passes its merged copy; outside it, pass your own). Colour follows the state: green for a rate in force (approved / set), butter for asked, grey for standard and mixed.

Anatomy

A kit Pill with the state's tone and text; set text is CommissionRate form="long" (or the commission's label).

Variants

commission.stateToneText (en)When
'standard'mute"Standard 15%"No special rate.
'asked'warn"Asked: EGP 30 per item"Waiting for TRNDR.
'approved'ok"20% of sale" (the label)TRNDR approved it.
'set'ok"20% of sale" / "EGP 30 per item" (or label)Programs where the brand sets rates itself.
'mixed'mute"Mixed"Members on different rates.

States

Static; the state is the variant.

Types

GroupCommission (commission): { state: 'standard' } | { state: 'asked'; label } | { state: 'approved'; label } | { state: 'set'; kind; value; label? } | { state: 'mixed' }.

GroupCopy (copy): { creators(n), standard(rate), asked(label), mixed? }; mixed falls back to the built-in word.

Usage

<GroupCommissionPill commission={{ state: 'asked', label: 'EGP 30 per item' }} standardRate="15%"
  copy={{ creators: (n) => `${n} creators`, standard: (r) => `Standard ${r}`, asked: (l) => `Asked: ${l}` }} />
// A brand-set rate
<GroupCommissionPill commission={{ state: 'set', kind: 'percent', value: '20' }} standardRate="15%" copy={GROUP_COPY.en} />

Where it appears

  • Brand › Creators › Groups › group card footer and group drawer (BrandCreators).

Guidelines

Do

  • Pass the server's state; never infer "approved" from a rate.
  • Use GROUP_COPY[lang] (exported) unless you need custom words.

Don't

  • Don't colour it yourself; the tone carries the state.

RTL and Arabic

  • Arabic: "العادية 15%", "طلبت: 30 ج.م على القطعة", "20% من البيع", "مختلفة".

Tokens

Through Pill: ok, warn and mute tone pairs.

Accessibility

  • Plain text in a pill; the state is in the words ("Asked:", "Standard"), not only the colour.

Found in the source

  • ARIA attributes set: aria-label, aria-hidden.

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

See also: AvatarStack · MoneyNote · Money · Pill · useLanguage · useMoneyDisplay · NewCard · CommissionInput · GroupForm

Source

src/blocks/groups/GroupCard.tsx (line 47) on GitHub.

On this page