useGiftColumnsCopy
The preset's words with the BricksProvider's labels.prGiftColumns over the defaults (and own over both): giftShipmentColumns(language, useGiftColumnsCopy(language)). The toolbar takes search, sortBrand, sortUnits.
import { useGiftColumnsCopy } from '@ergasti/bricks';Examples
A shipment's status, and "Problem reported" beside it while the brand disputes PR's count
Code
import { GiftStatusPills } from '@ergasti/bricks';
function Pills() {
return (
<div style={{ display: 'grid', gap: 10, justifyItems: 'start' }}>
<GiftStatusPills state="expected" />
<GiftStatusPills state="arrived" />
<GiftStatusPills state="confirmed_diff" problem />
<GiftStatusPills state="confirmed" />
</div>
);
}The Gift stock list: status chips over giftShipmentColumns (reference, brand, for, units claimed and confirmed, status)
giftShipmentMatches filters by a chip; "Problem reported" matches any state with an open report.
Code
import { useState } from 'react';
import { DataTable, GiftStatusFilter, giftShipmentColumns, giftShipmentMatches, type GiftShipmentFilter, type GiftShipmentRow } from '@ergasti/bricks';
const glow = { id: 'glow', name: 'Glow Lab', color: '#C7325C' };
const rows: GiftShipmentRow[] = [
{ id: 'GS-0017', sent: '17 Nov', brand: glow, for: 'December glow', claimed: 40, state: 'expected' },
{ id: 'GS-0013', sent: '15 Nov', brand: { id: 'kemet', name: 'Kemet Home', color: '#3D5A10' }, for: 'Weekend sprint', claimed: 40, state: 'arrived' },
{ id: 'GS-0014', sent: '9 Nov', brand: glow, for: 'Lip oil bundle push', claimed: 60, confirmed: 54, state: 'confirmed_diff', problem: true },
{ id: 'GS-0009', sent: '28 Oct', brand: glow, for: 'Winter glow launch', claimed: 115, confirmed: 115, state: 'confirmed' },
];
function GiftStockList() {
const [chip, setChip] = useState<GiftShipmentFilter | 'all'>('all');
return (
<div style={{ display: 'grid', gap: 14 }}>
<GiftStatusFilter value={chip} onChange={setChip} />
<DataTable label="Gift shipments" columns={giftShipmentColumns('en')} rows={rows.filter((r) => giftShipmentMatches(chip, r))} rowKey={(r) => r.id} onRowClick={() => {}} />
</div>
);
}Signature
function useGiftColumnsCopy(language?: Lang | undefined, own?: Partial<{ readonly reference: string; readonly brand: string; readonly for: string; readonly claimed: string; readonly confirmed: string; readonly status: string; readonly sent: (date: string) => string; readonly notYet: string; readonly search: string; readonly sortBrand: string; readonly sortUnits: string; readonly label: string; }> | undefined): { readonly reference: string; readonly brand: string; readonly for: string; readonly claimed: string; readonly confirmed: string; readonly status: string; readonly sent: (date: string) => string; readonly notYet: string; readonly search: string; readonly sortBrand: string; readonly sortUnits: string; readonly label: string; }Parameters
Prop
Type
Returns
{ readonly reference: string; readonly brand: string; readonly for: string; readonly claimed: string; readonly confirmed: string; readonly status: string; readonly sent: (date: string) => string; readonly notYet: string; readonly search: string; readonly sortBrand: string; readonly sortUnits: string; readonly label: string; }
Related
BrandCell · GiftStatusPills · GiftStockList · GiftStatusFilter · DataTable · useCampaignColumnsCopy · useGiftAnalyticsCopy · usePrColumnsCopy
Source
src/pr/gifts/giftShipmentColumns.tsx (line 59) on GitHub.