-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMain.tsx
100 lines (92 loc) · 2.18 KB
/
Main.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { Button } from "antd";
import styles from "./Main.module.scss";
import { useNavigate } from "react-router-dom";
import { Table } from "antd";
function Main() {
const navigate = useNavigate();
const DeleteButton = (text: string, link: string) => {
return (
<Button type="primary" danger onClick={() => navigate(link)}>
{text}
</Button>
);
};
const EditButton = (text: string, link: string) => {
return (
<Button type="primary" onClick={() => navigate(link)}>
{text}
</Button>
);
};
const AddButton = (text: string, link: string) => {
return (
<Button
type="primary"
style={{ backgroundColor: "green" }}
onClick={() => navigate(link)}
>
{text}
</Button>
);
};
const columns = [
{
title: "Game",
dataIndex: "game",
key: "game",
},
{
title: "Tag",
dataIndex: "tag",
key: "tag",
},
{
title: "User",
dataIndex: "user",
key: "user",
},
{
title: "Achievement",
key: "achievement",
dataIndex: "achievement",
},
{
title: "Character",
key: "character",
dataIndex: "character",
},
];
const data = [
{
key: "1",
game: AddButton("Create Game", "/create-game"),
tag: AddButton("Create Tag", "/create-tag"),
user: DeleteButton("Ban User", "/ban-user"),
achievement: AddButton("Create Achievement", "/create-achievement"),
character: AddButton("Add Character", "/add-character"),
},
{
key: "2",
game: EditButton("Update Game", "/update-game"),
tag: EditButton("Update Tag", "/update-tag"),
user: EditButton("Give Admin Permission", "/admin-permission"),
achievement: DeleteButton("Delete Achievement", "/delete-achievement"),
},
{
key: "3",
game: DeleteButton("Delete Game", "/delete-game"),
tag: DeleteButton("Delete Tag", "/delete-tag"),
},
];
return (
<div className={styles.container}>
<Table
dataSource={data}
columns={columns}
pagination={false}
bordered={true}
/>
</div>
);
}
export default Main;