Print checkout

Choose a paper stock and edition quantity, then place a sample print order.

Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/checkout-desk.json

Usage

import { Cyber } from "@/components/ui/cyber"
import Recipe from "@/components/recipes/checkout-desk"

export default function App() {
  return (
    <Cyber>
      <Recipe />
    </Cyber>
  )
}

Source

"use client"

import "./recipe-layout.css"
import { useState } from "react"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { ChoiceList } from "@/components/ui/choice-list"
import { Readout } from "@/components/ui/readout"
import { Stepper } from "@/components/ui/stepper"

const papers = [
  { value: "matte", label: "Matte stock · $12 / print" },
  { value: "foil", label: "Silver foil · $18 / print" },
]

export default function CheckoutDesk() {
  const [paper, setPaper] = useState("matte")
  const [quantity, setQuantity] = useState<number | null>(2)
  const [ordered, setOrdered] = useState(false)
  const total = (quantity ?? 0) * (paper === "foil" ? 18 : 12)
  const validQuantity = quantity !== null && Number.isInteger(quantity) && quantity >= 1 && quantity <= 9

  return (
    <div className="sink-stack">
      <div className="sink-between"><strong>Night Shift print</strong><Badge tone="mute">A3 edition</Badge></div>
      <ChoiceList label="Paper" options={papers} value={paper} onValueChange={(next) => {
        if (!next) return
        setPaper(next)
        setOrdered(false)
      }} />
      <Stepper label="Print quantity" min={1} max={9} value={quantity} onValueChange={(next) => {
        setQuantity(next)
        setOrdered(false)
      }} />
      <div className="sink-between">
        <Readout label="Order total" value={total} prefix="$" size="sm" />
        <Button size="sm" disabled={ordered || !validQuantity} onClick={() => setOrdered(true)}>Place demo order</Button>
      </div>
      {ordered && <p role="status" className="sink-note">Order recorded for {quantity} {paper === "foil" ? "silver foil" : "matte"} {quantity === 1 ? "print" : "prints"} at ${total}.</p>}
    </div>
  )
}

Components in this recipe

  • Choice list — Replies to choose from: rows in the signal color, the chosen one a solid yellow bar.
  • Number stepper — A value on a readout between minus and plus keys, with MIN and MAX tags.
  • Readout — A large numeral with a unit and a label that counts to its new value when it changes.
  • Badge — A small cut label in seven tones, with count and status variants.
  • Button — A cut-corner button with a raised tab, five tones, and a press flash. Enable the cipher prop to scramble the label and briefly tear the frame on hover.

Resources

View as Markdown