SenderCell
The history table's "From": TRNDR's ink square, or the brand the message was sent on behalf of. The square is the mock's 28px one (fromCell); avatarSize="md" draws the 38px square brand senders had before.
import { SenderCell } from '@ergasti/bricks';Examples
Message table cells
Who a message went to, who sent it (a brand, or TRNDR when null) and the open rate; the building blocks of the messages table preset.
Code
import { AudienceLabel, OpenRate, SenderCell } from '@ergasti/bricks';
import { brands } from './pr';
function Cells() {
return (
<div style={{ display: 'grid', gap: 12 }}>
<AudienceLabel audience={{ kind: 'all' }} />
<AudienceLabel audience={{ kind: 'brand', brand: brands.glow }} />
<AudienceLabel audience={{ kind: 'tier', tier: 'elite' }} />
<AudienceLabel audience={{ kind: 'group', name: 'Top sellers' }} />
<AudienceLabel audience={{ kind: 'picked', creators: [{ name: 'Nour Hassan', seed: 2 }, { name: 'Hana Rami', seed: 6 }] }} />
<div style={{ display: 'flex', gap: 24 }}><SenderCell brand={brands.mira} /><SenderCell brand={null} /><OpenRate percent={71} /></div>
</div>
);
}The mock's history table cells
SenderCell draws the mock's 28px square for brands and TRNDR (avatarSize="md" for the 38px one); OpenRate writes "62%" as one figure beside its bar.
Code
import { OpenRate, SenderCell } from '@ergasti/bricks';
import { brands } from './pr';
function SenderAndOpenRate() {
return (
<div style={{ display: 'grid', gap: 12 }}>
<div style={{ display: 'flex', gap: 24, alignItems: 'center' }}><SenderCell brand={brands.glow} /><SenderCell brand={null} /><SenderCell brand={brands.glow} avatarSize="md" /></div>
<div style={{ display: 'flex', gap: 24, maxWidth: 360 }}><OpenRate percent={62} /><OpenRate percent={100} /></div>
</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 prMessageCells, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
all | All TRNDR creators | كل صنّاع المحتوى على TRNDR |
brand | Brand | براند |
group | Group | مجموعة |
tier | Tier | مستوى |
more | +{n} | +{n} |
opened | {p}% opened | اتفتحت {p}% |
trndr | TRNDR | TRNDR |
Design guidance
How the BRICKS design system uses SenderCell. Written in docs/content/components/SenderCell.md; the props above are read from the code, which wins where the two disagree.
The "From" cell of the Messages history: TRNDR's ink square, or the brand the message was sent on behalf of; use it wherever a message's sender is listed.
SenderCell draws a BrandAvatar square and the bold name. A message sent by TRNDR shows the ink "T" square and "TRNDR"; one sent on behalf of a brand shows the brand's square and name. The square is the mock's 28px one (fromCell); avatarSize="md" draws the 38px square brand senders had before.
Anatomy
- Row:
<span class="kit-pr-person kit-pr-sender">. - Square:
BrandAvatar(sm28px ormd38px); TRNDR: ink with "T" (11px atsm). - Name: bold, one line.
Variants
| Prop | Value | Look | When to use |
|---|---|---|---|
brand | null | Ink "T" square, "TRNDR" | Sent by TRNDR |
StackBrand | Brand square in its colour, brand name | Sent on behalf of a brand | |
avatarSize | sm (default) | 28px square | The history table (the mock) |
md | 38px square | Larger lists, the earlier look |
States
Static.
Usage
import { SenderCell } from '@ergasti/bricks';
<SenderCell brand={null} />
<SenderCell brand={{ id: 'glow', name: 'Glow Lab', color: '#C7325C' }} />// Messages history (messageColumns draws it in "From")
<DataTable label="Sent messages" rows={messages} rowKey={(m) => m.id} columns={messageColumns('en')} />The mock's history table cells. SenderCell draws the mock's 28px square for brands and TRNDR (avatarSize="md" for the 38px one); OpenRate writes "62%" as one figure beside its bar. (docs example SenderAndOpenRate)
import { AudienceLabel, OpenRate, SenderCell } from '@ergasti/bricks';
// brands: the docs' sample rows (docs/examples/_pr.ts), e.g. brands.glow = { id: 'glow', name: 'Glow Lab', color: '#C7325C' }
export function SenderAndOpenRate() {
return (
<div style={{ display: 'grid', gap: 12 }}>
<div style={{ display: 'flex', gap: 24, alignItems: 'center' }}><SenderCell brand={brands.glow} /><SenderCell brand={null} /><SenderCell brand={brands.glow} avatarSize="md" /></div>
<div style={{ display: 'flex', gap: 24, maxWidth: 360 }}><OpenRate percent={62} /><OpenRate percent={100} /></div>
</div>
);
}Where it appears
- PR Portal › Messages › history table, "From" column; message drawer.
Guidelines
Do
- Pass the brand's colour so the square matches the brand everywhere.
- Keep
smin tables.
Don't
- Don't show a person here; the sending PR user goes in "Sent by".
RTL and Arabic
Mirrors (square on the right). The TRNDR name stays Latin.
Tokens
--ink, --color-text-inverted (TRNDR square), brand colour; BrandAvatar tokens.
Accessibility
- Role: none; a
<span>with the square and a<b>name. It is static content inside a table cell, so it has no keyboard stop and adds nothing to the focus order (the row or the table owns focus). - Text alternative: the name text ("TRNDR" or the brand name) is what a screen reader reads; the square repeats the initials and is not announced separately as an image.
- Changes: nothing updates live; a different sender is a different row.
- Contrast: the name is
--inkon the card (#141414 on white, 18.4:1). The TRNDR square is white "T" on ink (18.4:1); a brand square uses the brand's own colour, so pick brand colours that keep white initials at 4.5:1 or more.
Found in the source
- ARIA attributes set:
aria-hidden.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
SenderPicker: choosing the sender in the composer.BrandCell: a brand with a sub line.AudienceLabel,OpenRate.
See also: Avatar · BrandAvatar · PrIcon · useBricks · useLanguage · AnnouncementComposer · AudiencePicker · ChannelPicker
Source
src/pr/MessageCells.tsx (line 59) on GitHub.