◆ Northwind Goods
Studio Headphones
$349
Aurora Watch
$429
Mechanical Keyboard
$189
Drawer
tsx
"use client";import { Drawer } from "@/components/godui/drawer";import { useState } from "react";export function CartDrawer({ lines, total }) {const [open, setOpen] = useState(false);return ( <> <button onClick={() => setOpen(true)} className="rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground">Cart</button> <Drawer open={open} onOpenChange={setOpen} side="right" title="Your cart"> <ul className="space-y-3"> {lines.map((item) => ( <li key={item.id} className="flex justify-between text-sm"> <span>{item.name}</span> <span className="tabular-nums">{item.price}</span> </li> ))} </ul> <button onClick={() => setOpen(false)} className="mt-4 w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-primary-foreground">Checkout · {total}</button> </Drawer> </>);}