-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
82 lines (77 loc) · 1.71 KB
/
app.js
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import React from 'react'
import { render, Box, Text } from 'ink'
import BigText from 'ink-big-text'
import Gradient from 'ink-gradient'
import SelectInput from 'ink-select-input'
import open from 'open'
const handleSelect = item => {
item.url && open(item.url)
item.action && item.action()
}
const items = [
{
key: 'homepage',
label: 'Homepage',
url: 'https://zce.me'
},
{
key: 'twitter',
label: 'Twitter',
url: 'https://twitter.com/zceme'
},
{
key: 'weibo',
label: 'Weibo',
url: 'https://weibo.com/zceme'
},
{
key: 'blog',
label: 'Blog',
url: 'https://zenc.cn'
},
{
key: 'bilibili',
label: 'Bilibili',
url: 'https://space.bilibili.com/210242179'
},
{
key: 'github',
label: 'GitHub',
url: 'https://github.com/zce'
},
{
key: 'ask me',
label: 'Ask Me',
url: 'https://github.com/zce/zce/issues/new/choose'
},
{
key: 'contact',
label: 'Contact',
url: 'https://s.zce.me/qrcode/wechat.jpg'
},
{
key: 'donate',
label: 'Donate',
url: 'https://s.zce.me/qrcode/alipay.jpg'
},
// TODO: Add separator item here when https://github.com/vadimdemedes/ink-select-input/issues/4 is done
{
key: 'quit',
label: 'Quit',
action: () => process.exit()
}
]
const App = () => (
<Box flexDirection='column'>
<Box padding={1}>
<Gradient name='rainbow'>
<Text>Hey! Guys</Text>
<BigText text="I'm Lei Wang" />
<Text>A technical narrator of China. Aha!</Text>
</Gradient>
</Box>
<SelectInput items={items} onSelect={handleSelect} />
</Box>
)
console.clear()
render(<App />)