Skip to Content
BBRICKSv0.7.4
PR PortalGifts

WarehouseNote

The mock's whCard(): an info banner with the gift icon, "Send to: <address> · <hours> · <phone> · Open location in Maps ↗" (a new tab, said to a screen reader). In the "Record gifts for a brand" dialog, and on a brand's Gifts page.

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

Examples

Record gifts a brand sent without a claim: the warehouse banner, the brand's products with units, boxes and where they are now

Code
import { useState } from 'react';
import { Button, RecordGiftsDialog, type WarehouseDetails } from '@ergasti/bricks';

const WH: WarehouseDetails = { address: 'Warehouse 4, Industrial Zone 3, 6th of October City, Giza (sample)', hours: 'Sun–Thu · 10:00–17:00', phone: '+20 100 000 0000' };

const brands = [
  { id: 'glow', name: 'Glow Lab', products: ['Red lipstick', 'Eyeshadow palette', 'Lash mascara'].map((name, i) => ({ id: `g${i}`, name, sku: `GL-${101 + i}` })) },
  { id: 'nile', name: 'Nile Threads', products: ['Linen shirt', 'Cotton tote'].map((name, i) => ({ id: `n${i}`, name, sku: `NI-${101 + i}` })) },
];

function RecordGifts() {
  const [open, setOpen] = useState(false);
  const [last, setLast] = useState('');
  return (
    <>
      <Button onClick={() => setOpen(true)}>Record gifts for a brand</Button> <small>{last}</small>
      <RecordGiftsDialog open={open} onClose={() => setOpen(false)} brands={brands} warehouse={WH}
        onSave={(g) => { setLast(`${g.lines.reduce((a, l) => a + l.units, 0)} units, ${g.boxes} boxes, ${g.state}`); setOpen(false); }} />
    </>
  );
}

Where brands send gifts: the "Send to:" banner (with a Maps link) and the card PR edits it in

Code
import { useState } from 'react';
import { WarehouseDetailsCard, WarehouseNote, type WarehouseDetails } from '@ergasti/bricks';

const WH: WarehouseDetails = { address: 'Warehouse 4, Industrial Zone 3, 6th of October City, Giza (sample)', hours: 'Sun–Thu · 10:00–17:00', phone: '+20 100 000 0000' };

function Warehouse() {
  const [wh, setWh] = useState(WH);
  return (
    <div style={{ display: 'grid', gap: 16 }}>
      <WarehouseNote warehouse={wh} />
      <WarehouseDetailsCard value={wh} onSave={setWh} />
    </div>
  );
}

Saving

Pass busy while your request runs: Save is disabled. defaultBrandId opens the dialog on one brand (from that brand's page).

Code
import { RecordGiftsDialog, type WarehouseDetails } from '@ergasti/bricks';

const WH: WarehouseDetails = { address: 'Warehouse 4, Industrial Zone 3, 6th of October City, Giza (sample)', hours: 'Sun–Thu · 10:00–17:00', phone: '+20 100 000 0000' };

const brands = [
  { id: 'glow', name: 'Glow Lab', products: ['Red lipstick', 'Eyeshadow palette', 'Lash mascara'].map((name, i) => ({ id: `g${i}`, name, sku: `GL-${101 + i}` })) },
  { id: 'nile', name: 'Nile Threads', products: ['Linen shirt', 'Cotton tote'].map((name, i) => ({ id: `n${i}`, name, sku: `NI-${101 + i}` })) },
];

function Busy() {
  return <RecordGiftsDialog open onClose={() => {}} onSave={() => {}} busy defaultBrandId="nile" brands={brands} warehouse={WH} />;
}

Server error

When saving fails, pass its message as error: it is announced in the footer and what the user filled in stays.

Code
import { RecordGiftsDialog, type WarehouseDetails } from '@ergasti/bricks';

const WH: WarehouseDetails = { address: 'Warehouse 4, Industrial Zone 3, 6th of October City, Giza (sample)', hours: 'Sun–Thu · 10:00–17:00', phone: '+20 100 000 0000' };

const brands = [
  { id: 'glow', name: 'Glow Lab', products: ['Red lipstick', 'Eyeshadow palette', 'Lash mascara'].map((name, i) => ({ id: `g${i}`, name, sku: `GL-${101 + i}` })) },
  { id: 'nile', name: 'Nile Threads', products: ['Linen shirt', 'Cotton tote'].map((name, i) => ({ id: `n${i}`, name, sku: `NI-${101 + i}` })) },
];

function ServerError() {
  return <RecordGiftsDialog open onClose={() => {}} onSave={() => {}} error="We could not save these gifts. Try again." brands={brands} warehouse={WH} />;
}

Another cap

maxUnits (default 999, the mock's rule) is the most units one product may hold; set it, and the error names the range ("Enter 1 to 5,000 units for each ticked product"). Tick a product, type 6000 and Save to see it.

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

const brands = [
  { id: 'glow', name: 'Glow Lab', products: ['Red lipstick', 'Eyeshadow palette', 'Lash mascara'].map((name, i) => ({ id: `g${i}`, name, sku: `GL-${101 + i}` })) },
  { id: 'nile', name: 'Nile Threads', products: ['Linen shirt', 'Cotton tote'].map((name, i) => ({ id: `n${i}`, name, sku: `NI-${101 + i}` })) },
];

function MaxUnits() {
  return <RecordGiftsDialog open onClose={() => {}} onSave={() => {}} maxUnits={5000} brands={brands} />;
}

Props

Prop

Type

Labels

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

prWarehouse
KeyEnglishArabic
sendToSend to:ابعت على:
mapsOpen location in Maps ↗افتح المكان على الخريطة ↗
newTab(opens in a new tab)(بيفتح في تاب جديد)
titleWarehouse detailsبيانات المخزن
subEvery brand sees these on its Gifts pageكل براند بتشوف البيانات دي في صفحة الهدايا بتاعتها
saveSaveاحفظ
addressAddressالعنوان
hoursReceiving hoursمواعيد الاستلام
phonePhone for brand questionsتليفون لأسئلة البراندات
addressErrAddress is neededلازم تكتب العنوان
phoneErrPhone is neededلازم تكتب التليفون
loadingLoading the warehouse details…بنحمّل بيانات المخزن…
loadErrorCouldn’t load the warehouse details. Try again.مقدرناش نحمّل بيانات المخزن. جرّب تاني.
retryTry againجرّب تاني

Design guidance

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

An info banner that tells a brand where to send gifts ("Send to: <address> · <hours> · <phone> · Open location in Maps ↗"); use it wherever someone is about to ship or record gifts.

It is the PR mock's whCard(): an info Banner with the gift icon at the top of the "Record gifts for a brand" dialog; the source also names a brand's Gifts page as its home. It reads the warehouse details PR saves in WarehouseDetailsCard, skips empty parts, and links to a Google Maps search for the address unless you pass your own link or null.

Anatomy

  1. Banner (kit Banner tone="info" icon="gift", .kit-banner--info): 12px × 16px padding, radius 16, --sky fill, --sky-ink text, 13px.
  2. Icon (.kit-banner-ic, aria-hidden): the gift glyph at the start.
  3. Lead (<b>): "Send to:".
  4. Parts: address, hours, phone, each in a <bdi>, joined by " · "; blank parts are dropped.
  5. Maps link (optional, .kit-pr-glink): raspberry, 600, "Open location in Maps ↗", opens a new tab; a visually hidden "(opens in a new tab)" follows.

Variants

Prop / valueLookUse when
mapsUrl omittedLink to warehouseMapsUrl(address) (a Google Maps search)Default.
mapsUrl="https://…"Link to your URLYou have a pinned map link.
mapsUrl={null}No linkMaps is not wanted (print, or an address that will not geocode).

An unsafe URL (anything safeHref rejects) also drops the link.

States

  • Default: all three parts and the link.
  • Missing part: hours: '' (or only spaces) leaves it out with its separator.
  • Long address: wraps inside the banner; keep the address to one line of the real postal form.
  • Link hover / focus-visible: underline; focus ring with --radius-xs corners.
  • No loading or error state: render it once the details are loaded.

Types

WarehouseDetails (warehouse): { address: string; hours: string; phone: string } ("Sun–Thu · 10:00–17:00" for hours). PrWarehouseCopy (labels): sendTo, maps, newTab (and the card's words); also labels.prWarehouse on the provider.

Usage

const WH: WarehouseDetails = {
  address: 'Warehouse 4, Industrial Zone 3, 6th of October City, Giza',
  hours: 'Sun–Thu · 10:00–17:00',
  phone: '+20 100 000 0000',
};

// On its own, above a list of shipments
<WarehouseNote warehouse={WH} />
// Inside a dialog body, first thing the user reads (RecordGiftsDialog does this with its `warehouse` prop)
<Modal open={open} onClose={close} title="Record gifts for a brand" footer={footer}>
  <WarehouseNote warehouse={WH} />
  <FormField label="Brand"><select>…</select></FormField>
</Modal>
// A pinned map link, or none
<WarehouseNote warehouse={WH} mapsUrl="https://maps.app.goo.gl/abc123" />
<WarehouseNote warehouse={WH} mapsUrl={null} />

Where it appears

  • PR Portal › Gift stock › "Record gifts for a brand" dialog › top banner (mock recordGS → whCard()), via RecordGiftsDialog. Gallery screen gifts-record.
  • A brand's Gifts page › "Send to" note: named in the source as the second home of the note, but not drawn in the v3 brand mock.
  • Screen: PR · Gift stock; dialog card: RecordGiftsDialog.

Guidelines

Do

  • Feed it the same WarehouseDetails the Gift stock page saves, so brands and PR see one address.
  • Keep hours in the "Days · HH:MM–HH:MM" form.
  • Put it at the top of any flow that ends in shipping gifts.

Don't

  • Don't use it for warnings: it is tone="info", role="status".
  • Don't put more than one on a page.
  • Don't format the phone with spaces stripped: show it as people dial it.

RTL and Arabic

  • The icon moves to the right; text runs right to left; "↗" stays as written.
  • Arabic copy: "ابعت على:", "افتح المكان على الخريطة ↗", "(بيفتح في تاب جديد)".
  • Pass the Arabic address and hours if you have them; the phone stays in Latin digits inside <bdi>.

Tokens

--sky, --sky-ink, --rasp, --focus-ring, --radius-xs.

Accessibility

  • The kit Banner is role="status"; the icon is aria-hidden.
  • The Maps link has target="_blank" rel="noopener noreferrer" and says "(opens in a new tab)" to screen readers only (.kit-pr-sr).
  • Parts sit in <bdi>, so a Latin phone number inside Arabic text keeps its order.
  • Text is --sky-ink on --sky; the link is --rasp, weight 600, so it reads as a link without relying on underline alone.

Found in the source

  • Roles in the markup: alert.

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

See also: Button · Card · FormField · useLanguage · BrandGiftStockCard · GiftAttentionList · GiftClaimCheck · GiftShipmentCard

Source

src/pr/gifts/Warehouse.tsx (line 60) on GitHub.

On this page