Diff Snippet

function greet(name) {
return 'Hi ' + name;
return `Hello, ${name}!`;
}
About this piece

Diff Snippet

Compact diff card with added, removed, and context lines tinted in emerald and rose.

Usage

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}
/>

More Code pieces

View all Code
greet.ts
export function greet(name: string) {
return `Hello, ${name}!`;
}
 
console.log(greet("Beste"));
members.ts
import { Sirius } from '@sirius/sdk'
const client = new Sirius(apiKey)
await client.members.create({ name })
pricing.ts
export function total(cart: Cart) {
const sum = cart.lines.reduce(add, 0)
return sum
const discount = coupon(cart, sum)
return sum - discount
}
const greeting = "Hello, Beste!";ts
const user = await fetchUser("42");
{
"name":"Beste",
"active":true,
"count":42
}