master @ 20 LINES
[ HISTORY ] [ UP ]
┌─ TS ───────────────────────────────────────────────────────────────────────┐
│ import { box, center, wrap } from "../../lib/ascii"; │
│ │
│ export interface Props { │
│ width?: number; │
│ /** Card kicker, e.g. "NOTE" or "REFERENCE COPY". */ │
│ label: string; │
│ title: string; │
│ } │
│ │
│ export function buildTitleCard(width: number, label: string, title: string): strin │
│ g { │
│ const cardW = Math.min(46, width - 8); │
│ const titleLines = wrap(title, cardW - 4).split("\n"); │
│ const card = box({ │
│ width: cardW, │
│ lines: [label, ...titleLines], │
│ align: "center", │
│ }); │
│ return card.split("\n").map((line) => center(line, width)).join("\n"); │
│ } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ TS ─────────────────────────────────┐
│ import { box, center, wrap } from "../../lib │
│ /ascii"; │
│ │
│ export interface Props { │
│ width?: number; │
│ /** Card kicker, e.g. "NOTE" or "REFERENCE │
│ COPY". */ │
│ label: string; │
│ title: string; │
│ } │
│ │
│ export function buildTitleCard(width: number │
│ , label: string, title: string): string { │
│ const cardW = Math.min(46, width - 8); │
│ const titleLines = wrap(title, cardW - 4). │
│ split("\n"); │
│ const card = box({ │
│ width: cardW, │
│ lines: [label, ...titleLines], │
│ align: "center", │
│ }); │
│ return card.split("\n").map((line) => cent │
│ er(line, width)).join("\n"); │
│ } │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET