export function total(cart: Cart) { const sum = cart.lines.reduce(add, 0) return sum const discount = coupon(cart, sum) return sum - discount}Code diff under a filename header whose removed and added lines slide into place one after another on mount.
The import and the props worth knowing about, in one place.
import { Code14 } from "@/components/beste/piece/code14";
<Code14
filename="pricing.ts"
lines={[
{
"text": "export function total(cart: Cart) {"
},
{
"text": " const sum = cart.lines.reduce(add, 0)"
},
{
"text": " return sum",
"kind": "removed"
},
{
"text": " const discount = coupon(cart, sum)",
"kind": "added"
},
{
"text": " return sum - discount",
"kind": "added"
},
{
"text": "}"
}
]}
bordered={false}
/>