Workshop feedback

Rate a workshop, add an optional note, and record the response.

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/feedback-desk.json

Usage

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

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

Source

"use client"

import "./recipe-layout.css"
import { useState } from "react"
import { Button } from "@/components/ui/button"
import { Rating } from "@/components/ui/rating"
import { Textarea } from "@/components/ui/textarea"

const levels = ["Difficult", "Uneven", "Fair", "Good", "Excellent"]

export default function FeedbackDesk() {
  const [score, setScore] = useState<number | null>(null)
  const [note, setNote] = useState("")
  const [recorded, setRecorded] = useState(false)

  return (
    <form className="sink-stack" onSubmit={(event) => {
      event.preventDefault()
      if (score !== null) setRecorded(true)
    }}>
      <strong>How was the workshop?</strong>
      <Rating label="Workshop rating" value={score} levels={levels} onValueChange={(next) => {
        setScore(next)
        setRecorded(false)
      }} />
      <Textarea label="Notes (optional)" placeholder="What should we keep or change?" maxLength={180} rows={2} value={note} onValueChange={(next) => {
        setNote(next)
        setRecorded(false)
      }} />
      <div className="sink-row">
        <Button type="submit" size="sm" disabled={score === null || recorded}>Record feedback</Button>
        <span className="sink-note" role="status">{recorded ? `Recorded ${score}/5${note.trim() ? " with notes" : ""}.` : ""}</span>
      </div>
    </form>
  )
}

Components in this recipe

  • Rating — A level picked from a row of diamond pips.
  • Textarea — A labelled multi-line input with a character count.
  • 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