TopUpResultBanner
The card top-up's outcome as a banner: paid (lime), waiting for Paymob (info), failed (an alert, with Try again).
import { TopUpResultBanner } from '@ergasti/bricks';Examples
Top-up outcomes
After the card page returns: paid, still pending, or failed with a Try again action. A null result draws nothing.
Code
import { TopUpResultBanner } from '@ergasti/bricks';
function Results() {
return (
<div style={{ display: 'grid', gap: 10 }}>
<TopUpResultBanner result="ok" onDismiss={() => {}} />
<TopUpResultBanner result="pending" onDismiss={() => {}} />
<TopUpResultBanner result="failed" onRetry={() => {}} onDismiss={() => {}} />
</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 topUpResultBanner, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
ok | Card top-up paid. Your wallet is updated. | الشحن بالكارت اتم. محفظتك اتحدّثت. |
pending | Card top-up sent. Your wallet updates as soon as Paymob confirms the payment. | الشحن بالكارت اتبعت. المحفظة هتتحدّث أول ما Paymob تأكد الدفع. |
failed | The card payment did not go through. Try again or use another card. | الدفع بالكارت ماتمش. جرّب تاني أو استخدم كارت تاني. |
retry | Try again | جرّب تاني |
dismiss | Dismiss | اقفل |
Design guidance
How the BRICKS design system uses TopUpResultBanner. Written in docs/content/components/TopUpResultBanner.md; the props above are read from the code, which wins where the two disagree.
The card top-up's outcome as a banner: paid (lime), waiting for Paymob (info) or failed (red, with Try again); use it at the top of the Wallet tab when the payment page sends the brand back.
The server or the payment return URL says topup=ok|pending|failed; pass that word as result. Any other value (null, an older or newer server's word) draws nothing, so you can pass the query parameter straight in. The mock does not draw it; the library builds it for the real flow next to TopUpAmountPicker.
Anatomy
A kit Banner:
- Icon: check (ok), clock (pending), alert (failed).
- Message: one sentence per result.
- Actions (
.kit-blk-res-act, optional): "Try again" (small button, failed only, withonRetry) and "Dismiss" (ghost, withonDismiss).
Variants
result | Tone / icon | Message |
|---|---|---|
'ok' | lime / check | "Card top-up paid. Your wallet is updated." |
'pending' | info / clock | "Card top-up sent. Your wallet updates as soon as Paymob confirms the payment." |
'failed' | bad / alert | "The card payment did not go through. Try again or use another card." |
| anything else | — | Nothing rendered. |
States
| State | How |
|---|---|
| With actions | onRetry (failed only) and/or onDismiss. |
| No actions | Neither handler. |
| Hidden | result null or unknown. |
Types
TopUpResult (result): 'ok' | 'pending' | 'failed'; anything else draws nothing. TopUpResultCopy (labels): ok, pending, failed, retry, dismiss.
Usage
import { Button, HeroCard, TopUpResultBanner, WalletHealthCard } from '@ergasti/bricks';
// Wallet tab, right under the page tabs
export function WalletTab({ reopenTopUp, clearParam }: { reopenTopUp: () => void; clearParam: () => void }) {
const result = new URLSearchParams(window.location.search).get('topup');
return (
<>
<TopUpResultBanner result={result} onRetry={reopenTopUp} onDismiss={clearParam} />
<div className="scr-grid scr-grid--75">
<HeroCard deco={false} figures={{ available: '43390.00', balance: '61840.00', held: '18450.00', toppedUp: '287800.00', lastTopup: '250000.00', leftPercent: 17, low: true }}
actions={<Button variant="white" onClick={reopenTopUp}>Top up</Button>} />
<WalletHealthCard leftPercent={17} lastTopup="250000.00" lowPercent={20} pauseDays={7} />
</div>
</>
);
}Where it appears
- Brand › Payments › Wallet tab, after returning from the Paymob card payment (not drawn in the v3 mock).
- Library gallery:
gallery/MissingBrandGallery.tsx("Payments · Top up by card").
Guidelines
Do
- Pass the server's word unchanged; the component ignores unknown values.
- Offer Dismiss so the banner does not stay on every visit.
- Refresh the wallet figures on
ok.
Don't
- Don't show it together with a toast for the same result.
- Don't reword "pending" as success: the money is not in the wallet yet.
RTL and Arabic
- Icon and actions mirror.
- Arabic: "الشحن بالكارت اتم. محفظتك اتحدّثت.", "جرّب تاني", "اقفل".
Tokens
Banner tones: lime --lime-50 / --olive, info (the base banner) --sky / --sky-ink, bad --rasp-50 / --rasp-ink; kit button tokens.
Accessibility
- A kit
Banner: the message is text, the icon decorative; tone is never the only signal. - Buttons are real
<button>s with visible words. - If it appears without a page load (SPA return), consider moving focus or announcing via your app's live region.
Found in the source
- No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
TopUpAmountPicker: the form before the payment page.Banner: the general banner.BundleResultBanner: the same pattern for UGC bundle purchases.
See also: Button · useLanguage
Source
src/blocks/topup/TopUpResultBanner.tsx (line 59) on GitHub.