-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.tsx
86 lines (78 loc) · 2.2 KB
/
popup.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
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
83
84
85
86
import { GithubOutlined, SettingOutlined } from "@ant-design/icons"
import { useMount } from "ahooks"
import { Button, Flex, Layout } from "antd"
import CssText from "data-text:./popup.less"
import antdResetCssText from "data-text:antd/dist/reset.css"
import { ThemeProvider } from "~theme"
const { Header, Footer, Content } = Layout
const headerStyle = {
textAlign: "center",
color: "#fff",
height: 64,
paddingInline: 48,
lineHeight: "64px",
background: "initial"
} satisfies React.CSSProperties
const contentStyle = {
textAlign: "center",
minHeight: 120,
lineHeight: "120px",
color: "#fff"
} satisfies React.CSSProperties
const footerStyle = {
textAlign: "center",
color: "#fff",
background: "initial"
} satisfies React.CSSProperties
const layoutStyle = {
overflow: "hidden",
width: "316px",
background: "#fff"
} satisfies React.CSSProperties
function IndexPopup() {
useMount(() => {
const style = document.createElement("style")
style.textContent = `${antdResetCssText}\n${CssText}`
document.head.appendChild(style)
return () => {
document.head.removeChild(style)
}
})
const openOptionsPage = () => {
chrome.runtime.openOptionsPage()
}
const navigateToGithub = () => {
window.open("https://github.com/ChuTingzj/tabs-master")
}
return (
<ThemeProvider>
<Layout style={layoutStyle}>
<Header style={headerStyle}>
<p className="header-title">{chrome.i18n.getMessage("Welcome")}</p>
</Header>
<Content style={contentStyle}>Content</Content>
<Footer style={footerStyle}>
<Flex justify="space-between">
<Button
onClick={openOptionsPage}
icon={<SettingOutlined />}
type="link"
color="primary"
size={"small"}>
{chrome.i18n.getMessage("Configuration")}
</Button>
<Button
onClick={navigateToGithub}
icon={<GithubOutlined />}
type="link"
color="primary"
size={"small"}>
GitHub
</Button>
</Flex>
</Footer>
</Layout>
</ThemeProvider>
)
}
export default IndexPopup