import { coupon } from "./coupon" export function total(cart: Cart) { const sum = cart.lines.reduce(add, 0) return sum const sum = cart.lines.reduce(add, 0) const discount = coupon(cart, sum) return sum - discount}Code diff whose removed and added lines slide into place one after another on mount, with the header tallying added and removed counts as they land.
The import and the props worth knowing about, in one place.
import { Code14 } from "@/components/beste/piece/code14";
<Code14
filename="pricing.ts"
lines={[
{
"text": "import { coupon } from \"./coupon\""
},
{
"text": ""
},
{
"text": "export function total(cart: Cart) {"
},
{
"text": " const sum = cart.lines.reduce(add, 0)",
"kind": "removed"
},
{
"text": " return sum",
"kind": "removed"
},
{
"text": " const sum = cart.lines.reduce(add, 0)",
"kind": "added"
},
{
"text": " const discount = coupon(cart, sum)",
"kind": "added"
},
{
"text": " return sum - discount",
"kind": "added"
},
{
"text": "}"
}
]}
/>function greet(name) { return 'Hi ' + name; return `Hello, ${name}!`;}Compact diff card with added, removed, and context lines tinted in emerald and rose.
const greeting = "Hello, Beste!";tsOne-line code snippet with a monospace pill and a tiny language tag on the right.
Stacked import statements with destructured names and module paths in a quiet syntax palette.
Dotenv listing with sky keys, italic muted comments, and grouped sections separated by blank lines.