xonecas.io
70160
Ce

cel-tui / files

cel-tui / examples / warning-box.ts

440 bytes
1import { Text } from "@cel-tui/core";
2
3export function warningBox(lines: string[]) {
4  const innerWidth = lines.reduce((max, line) => Math.max(max, line.length), 0);
5  const border = "─".repeat(innerWidth);
6
7  return [
8    Text(`┌${border}┐`, { fgColor: "color03" }),
9    ...lines.map((line) =>
10      Text(`│${line.padEnd(innerWidth)}│`, { fgColor: "color03" }),
11    ),
12    Text(`└${border}┘`, { fgColor: "color03" }),
13  ];
14}