Skip to content

Commit 6c33266

Browse files
committed
Create question table
1 parent 19afb28 commit 6c33266

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
File renamed without changes.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { Button, Card, Divider, Table, Text, Pagination, Group, Input } from "@mantine/core";
2+
import classes from "./table.module.css";
3+
4+
export type QuestionHistory = {
5+
question: string;
6+
dateAdded: string;
7+
lastEdited: string;
8+
difficulty: string;
9+
topic: string;
10+
};
11+
12+
export default function QuestionsTable({ data }: { data: QuestionHistory[] }) {
13+
const rows = data.map((row) => (
14+
<Table.Tr key={row.question}>
15+
<Table.Td>{row.question}</Table.Td>
16+
<Table.Td ta="right">{row.dateAdded}</Table.Td>
17+
<Table.Td ta="right">{row.lastEdited}</Table.Td>
18+
<Table.Td ta="right">{row.difficulty}</Table.Td>
19+
<Table.Td ta="right">{row.topic}</Table.Td>
20+
<Table.Td ta="right" style={{ width: 50 }}>
21+
<Button>Edit</Button>
22+
</Table.Td>
23+
<Table.Td ta="right" style={{ width: 50 }}>
24+
<Button>Delete</Button>
25+
</Table.Td>
26+
</Table.Tr>
27+
));
28+
return (
29+
<Card shadow="sm" padding="lg">
30+
<Group justify="space-between">
31+
<Text fw={1000} size="xl" c="white" mb={"xs"}>
32+
Questions
33+
</Text>
34+
<Input placeholder="Search" />
35+
</Group>
36+
37+
<Divider />
38+
<Table.ScrollContainer minWidth={500}>
39+
<Table c={"white"} highlightOnHover>
40+
<Table.Thead>
41+
<Table.Tr>
42+
<Table.Th>Question</Table.Th>
43+
<Table.Th className={classes.cell}>Date Added</Table.Th>
44+
<Table.Th className={classes.cell}>Last Edited</Table.Th>
45+
<Table.Th className={classes.cell}>Difficulty</Table.Th>
46+
<Table.Th className={classes.cell}>Topic</Table.Th>
47+
<Table.Th className={classes.cell} style={{ width: 50 }}></Table.Th>
48+
<Table.Th className={classes.cell} style={{ width: 50 }}></Table.Th>
49+
</Table.Tr>
50+
</Table.Thead>
51+
<Table.Tbody>{rows}</Table.Tbody>
52+
</Table>
53+
</Table.ScrollContainer>
54+
<Group justify="center">
55+
<Pagination total={5} siblings={3} defaultValue={1} />
56+
57+
</Group>
58+
</Card>
59+
);
60+
}

0 commit comments

Comments
 (0)