File size: 549 Bytes
fc93158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { Container, Markdown, Spacer } from "@mariozechner/pi-tui";
import { markdownTheme } from "../theme/theme.js";

type MarkdownOptions = ConstructorParameters<typeof Markdown>[4];

export class MarkdownMessageComponent extends Container {
  private body: Markdown;

  constructor(text: string, y: number, options?: MarkdownOptions) {
    super();
    this.body = new Markdown(text, 1, y, markdownTheme, options);
    this.addChild(new Spacer(1));
    this.addChild(this.body);
  }

  setText(text: string) {
    this.body.setText(text);
  }
}