Skip to Content
BBRICKSv0.7.4
PR PortalTable presets

usePrColumnsCopy

The presets' words with the BricksProvider's labels.prColumns over the defaults (and own over both). The presets are plain functions, so a screen passes this to them: brandColumns(language, usePrColumnsCopy(language)).

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

Examples

Words for a column preset

The PR column presets are plain functions, so they cannot read the provider; usePrColumnsCopy(language) returns their words with the provider's labels.prColumns laid over the defaults, and you pass it as the preset's copy argument. Here the provider renames two headers.

Code
import { BricksProvider, DataTable, brandColumns, usePrColumnsCopy, useLanguage } from '@ergasti/bricks';
import { brandRows } from './pr';

function Brands() {
  const language = useLanguage();
  const copy = usePrColumnsCopy(language);
  return <DataTable label="Brands" rows={brandRows} rowKey={(r) => r.id} columns={brandColumns(language, copy)} />;
}

function Renamed() {
  return (
    <BricksProvider labels={{ prColumns: { en: { owner: 'Account manager', sales: 'Sales · 30d' }, ar: { owner: 'مدير الحساب' } } }}>
      <Brands />
    </BricksProvider>
  );
}

Signature

function usePrColumnsCopy(language?: Lang | undefined, own?: Partial<PrColumnsCopy> | undefined): PrColumnsCopy

Parameters

Prop

Type

Returns

PrColumnsCopy

Avatar · Button · FollowersCell · Money · TierChip · ApprovalActions · WaitingCell · AuditAreaPill · BrandCell · AudienceLabel · OpenRate · SenderCell · PrStatusPill · WalletHealthPill

Source

src/pr/presets.tsx (line 60) on GitHub.

On this page