feat(ui): the QR card shared in @xenia/ui/qr (platform-v2 step 6.14c)
- QrCode (a QR on a light tile, optional caption; framed or not) in packages/ui, on its own subpath so only the apps that show one need qrcode.react (an optional peer); x-qr styles keep the code dark on light in dark themes - used by the terminal's customer display, the manager's online-ordering link, table QR codes and Settings' pairing QR (four copies of the same markup gone) - the money pad and the order line row stay where they are: the manager's payment is the phones' cash / card choice (no cash given, change or split) and its order lines are not the counter's cart lines, so neither has a second user; the signage slides keep their own QR (inline styles scaled to the TV) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
"./tokens.css": "./src/tokens.css",
|
||||
"./styles.css": "./src/styles.css",
|
||||
"./tailwind-preset": "./tailwind-preset.js",
|
||||
"./gallery": "./gallery/Gallery.jsx"
|
||||
"./gallery": "./gallery/Gallery.jsx",
|
||||
"./qr": "./src/components/QrCode.jsx"
|
||||
},
|
||||
"sideEffects": [
|
||||
"*.css"
|
||||
@@ -20,6 +21,12 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
"react-dom": "^19.0.0",
|
||||
"qrcode.react": "^4.2.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"qrcode.react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,3 +328,9 @@
|
||||
.x-reasons__option:hover { background: var(--x-surface-3); }
|
||||
.x-reasons__option:focus-visible { outline: none; box-shadow: var(--x-focus-ring); }
|
||||
.x-reasons__option--on, .x-reasons__option--on:hover { background: var(--x-accent); color: var(--x-accent-fg); }
|
||||
|
||||
/* ── QR code (QrCode, @xenia/ui/qr; plan step 6.14c) ─────────────────────── */
|
||||
.x-qr { display: grid; justify-items: center; gap: var(--x-space-2); }
|
||||
/* always light behind the code, in dark themes too: scanners need the contrast */
|
||||
.x-qr__tile { padding: var(--x-space-3); border-radius: var(--x-radius-card); border: 1px solid var(--x-line); background: var(--x-on-colour); line-height: 0; }
|
||||
.x-qr__caption { font-size: var(--x-text-label); color: var(--x-ink-2); text-align: center; }
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// A QR code on a light tile (plan step 6.14c; moved here from the terminal's customer display and
|
||||
// the manager's pages, where it was written four times). Its own subpath, `@xenia/ui/qr`, so only
|
||||
// the apps that show one need `qrcode.react` (the waiter app doesn't).
|
||||
//
|
||||
// <QrCode value={url} size={220} /> framed: a tile with padding and a line
|
||||
// <QrCode value={url} size={168} framed={false} /> just the code (in a card of its own)
|
||||
// <QrCode value={url} caption="Order online" /> a caption under the tile
|
||||
//
|
||||
// The code is always dark on light (scanners need the contrast), in light and dark themes alike.
|
||||
import { QRCodeSVG } from 'qrcode.react'
|
||||
import { cx } from '../internal/cx.js'
|
||||
|
||||
export function QrCode({ value, size = 160, framed = true, caption, className, captionClassName, ...rest }) {
|
||||
const code = <QRCodeSVG value={value} size={size} includeMargin={false} />
|
||||
return (
|
||||
<div className={cx('x-qr', className)} data-link={value} {...rest}>
|
||||
{framed ? <div className="x-qr__tile">{code}</div> : code}
|
||||
{caption && <p className={cx('x-qr__caption', captionClassName)}>{caption}</p>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user