-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.tsx
55 lines (50 loc) · 1.08 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from 'react';
import {Text} from 'ink';
import CFonts from 'cfonts';
export type CFontProps = {
font:
| 'block'
| 'slick'
| 'tiny'
| 'grid'
| 'pallet'
| 'shade'
| 'simple'
| 'simpleBlock'
| '3d'
| 'simple3d'
| 'chrome'
| 'huge';
align: 'left' | 'center' | 'right';
colors: string[];
backgroundColor:
| 'transparent'
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white';
letterSpacing: number;
lineHeight: number;
space: boolean;
maxLength: number;
};
export type BigTextProps = {text: string} & Partial<CFontProps>;
const defaultCFontProps: CFontProps = {
font: 'block',
align: 'left',
colors: ['system'],
backgroundColor: 'transparent',
letterSpacing: 1,
lineHeight: 1,
space: true,
maxLength: 0,
};
const BigText: React.FC<BigTextProps> = ({text, ...props}) => { // eslint-disable-line react/function-component-definition
const cFontProps = {...defaultCFontProps, ...props};
return <Text>{CFonts.render(text, cFontProps).string}</Text>; // eslint-disable-line @typescript-eslint/no-unsafe-call
};
export default BigText;