function greet(name) { return 'Hi ' + name; return `Hello, ${name}!`;}Compact diff card with added, removed, and context lines tinted in emerald and rose.
The import and the props worth knowing about, in one place.
import { Code4 } from "@/components/beste/piece/code4";
<Code4
lines={[
{
"kind": "context",
"text": "function greet(name) {"
},
{
"kind": "remove",
"text": " return 'Hi ' + name;"
},
{
"kind": "add",
"text": " return `Hello, ${name}!`;"
},
{
"kind": "context",
"text": "}"
}
]}
bordered={false}
/>export function greet(name: string) {return `Hello, ${name}!`;}console.log(greet("Beste"));
export function total(cart: Cart) { const sum = cart.lines.reduce(add, 0) return sum const discount = coupon(cart, sum) return sum - discount}