Skip to Content
BBRICKSv0.7.4
BlocksGroups

GroupCard

The Groups tab's card (.ccard): a tinted band, the name and member count, up to five faces and "+N", the commission pill and the group's sales with its "?". The whole card opens the group: one stretched button under the content (the Find card's pattern), so the sales "?" can be its own button beside it, not nested inside.

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

Labels

Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key groupCard, or with the component's own prop where it has one. A {name} is a value the component fills in.

groupCard
KeyEnglishArabic
creators2 creatorsليس رقمًا صانع محتوى
standardStandard {r}العادية {r}
askedAsked: {l}طلبت: {l}
mixedMixedمختلفة

Design guidance

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

A creator group card for the Groups tab: a tinted band, the group name and member count, up to five faces and "+N", the commission pill and the group's sales; the whole card opens the group drawer.

It is the mock's .ccard on Brand › Creators › Groups, laid out in a grid ending with the dashed "+ New group" card (NewCard). The card is one stretched button under the content (named "Top sellers, 12 creators"), so the sales "?" can be its own button beside it. Sales is the server's 2-dp string shown compact; leave it out until the API sends it.

Anatomy

  1. Card: article.kit-blk-gcard, min height 190, 1px line, --r-lg, lifts on hover; focus ring drawn around the card.
  2. Hit button: .kit-blk-hit covering the card.
  3. Band: 54px strip in the group's tone (kit-blk-tone--<tone>), decorative.
  4. Body: padding 16 18 18, 12px gaps:
    1. Row: name (16px bold, ellipsis) + muted "12 creators";
    2. Faces: AvatarStack (max 5, "+N" from memberCount);
    3. Footer: GroupCommissionPill + sales (MoneyNote figure="sales" around the compact amount).

Variants

PropValuesWhen
tone'lime' | 'rasp' | 'butter' | 'sky' | 'lilac'Band colour; one per group.
commission.statestandard / asked / approved / set / mixedSee GroupCommissionPill.
moneyMoneyDisplaySales display (default compact "EGP 184.3K").

States

StateTrigger
Default / hoverlift on hover.
Focus-visible2px --rasp outline around the card.
No membersmembers=[]: empty stack, "0 creators".
Before salessales undefined: no figure, no "?".
More than facesmemberCount > members.length: "+N".

Types

GroupCopy (labels): creators(n), standard(r), asked(l), mixed.

Usage

// Brand › Creators › Groups
<Banner tone="info" icon="creators">Group creators to ask TRNDR for a special commission for a group. A special commission applies only after the TRNDR team approves it.</Banner>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(260px, 1fr))', gap: 16 }}>
  {groups.map((g) => (
    <GroupCard key={g.id} name={g.name} tone={g.tone} members={g.members} memberCount={g.count}
      commission={g.commission} sales={g.sales} onOpen={() => openGroup(g.id)} />
  ))}
  <NewCard title="+ New group" onClick={openNewGroup} />
</div>
<GroupCard name="Top sellers" tone="lime" members={people} sales="314610.00"
  commission={{ state: 'approved', label: '20% of sale' }} onOpen={open} />

Where it appears

  • Brand › Creators › Groups › group cards (.ccard) (BrandCreators).

Guidelines

Do

  • Give each group a stable tone so card and drawer match.
  • Send memberCount when you send only the first faces.

Don't

  • Don't add buttons inside the card besides the sales "?"; actions live in the drawer.

RTL and Arabic

  • Mirrors; name dir="auto". Arabic count: "12 صانع محتوى".

Tokens

--card, --line, --r-lg, --rasp (focus), tone pairs --lime-50/--olive, --rasp-50, --butter/--butter-ink, --sky/--sky-ink, --lilac/--lilac-ink.

Accessibility

  • One button named "name, N creators"; the band and faces are decorative; the sales "?" is a separate button.
  • Focus outline wraps the whole card.

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: MoneyNote · Money · Pill · CommissionRate · useLanguage · useMoneyDisplay · CommissionInput

Source

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

On this page