35 lines
883 B
TypeScript
35 lines
883 B
TypeScript
|
|
import type { CSSProperties } from "react";
|
||
|
|
|
||
|
|
/** QR guest menu background textures (owner picks in Settings → Appearance). */
|
||
|
|
|
||
|
|
export const CAFE_MENU_TEXTURES = [
|
||
|
|
"none",
|
||
|
|
"paper",
|
||
|
|
"linen",
|
||
|
|
"dots",
|
||
|
|
"grid",
|
||
|
|
"marble",
|
||
|
|
"wood",
|
||
|
|
"warm",
|
||
|
|
] as const;
|
||
|
|
|
||
|
|
export type CafeMenuTexture = (typeof CAFE_MENU_TEXTURES)[number];
|
||
|
|
|
||
|
|
export function normalizeMenuTexture(value?: string | null): CafeMenuTexture {
|
||
|
|
if (value && (CAFE_MENU_TEXTURES as readonly string[]).includes(value)) {
|
||
|
|
return value as CafeMenuTexture;
|
||
|
|
}
|
||
|
|
return "none";
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Props for the textured QR menu shell (uses CSS in globals.css). */
|
||
|
|
export function qrMenuTextureShellProps(
|
||
|
|
texture: CafeMenuTexture,
|
||
|
|
backgroundColor: string
|
||
|
|
): { "data-qr-texture": CafeMenuTexture; style: CSSProperties } {
|
||
|
|
return {
|
||
|
|
"data-qr-texture": texture,
|
||
|
|
style: { ["--qr-bg" as string]: backgroundColor },
|
||
|
|
};
|
||
|
|
}
|