mirror of
https://github.com/earendil-works/pi.git
synced 2026-06-18 15:54:04 +08:00
18 lines
425 B
TypeScript
18 lines
425 B
TypeScript
import type { Component } from "@mariozechner/pi-tui";
|
|
import chalk from "chalk";
|
|
|
|
/**
|
|
* Dynamic border component that adjusts to viewport width
|
|
*/
|
|
export class DynamicBorder implements Component {
|
|
private color: (str: string) => string;
|
|
|
|
constructor(color: (str: string) => string = chalk.blue) {
|
|
this.color = color;
|
|
}
|
|
|
|
render(width: number): string[] {
|
|
return [this.color("─".repeat(Math.max(1, width)))];
|
|
}
|
|
}
|