Show the payment status pill on the invoices table

React · React · intermediate · greenfield

Adds the status pill as a lookup table plus a one-line fallback. Three known statuses, one neutral fallback for whatever the billing provider invents next, design-system classes for the styling. Deliberately no enum, no context, no theming indirection — it's a leaf cell in a table.

Requirements

Files touched

--- src/components/StatusPill.jsx
+const STATUS_STYLES = {
+  paid: { label: 'Paid', className: 'pill pill-success' },
+  pending: { label: 'Pending', className: 'pill pill-warning' },
+  failed: { label: 'Failed', className: 'pill pill-danger' },
+};
+
+export function StatusPill({ status }) {
+  const entry = Object.hasOwn(STATUS_STYLES, status)
+    ? STATUS_STYLES[status]
+    : { label: status.trim() || 'Unknown', className: 'pill' };
+  return <span className={entry.className}>{entry.label}</span>;
+}
+

Review this PR

React practice