Skip to content

Commit 16df602

Browse files
Create View Question detail page
1 parent c5faa57 commit 16df602

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.fit-parent {
2+
width: 100%;
3+
height: 100%;
4+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { redirect, LoaderFunction, useLoaderData } from "react-router-dom";
2+
import { HStack, VStack, Box, Heading, Center } from "@chakra-ui/react";
3+
import { dummyQnLookup } from "../../data/sampleqn";
4+
import { Question } from "../../models/Quesiton.model";
5+
import { QnDrawer } from "../../components/QnDrawer/QnDrawer.component";
6+
7+
import "./ViewQuestion.page.css";
8+
9+
export const qnLoader: LoaderFunction<Question> = async ({ params }) => {
10+
if (!params.id || !dummyQnLookup.has(params.id)) {
11+
return redirect("/");
12+
}
13+
14+
return dummyQnLookup.get(params.id);
15+
};
16+
17+
const ViewQuestion = () => {
18+
const qn = useLoaderData() as Question;
19+
20+
return (
21+
<>
22+
<QnDrawer question={qn} size="xl" />
23+
<HStack className="fit-parent">
24+
<Box backgroundColor="blue.300" className="fit-parent">
25+
<Center>
26+
<Heading>editor</Heading>
27+
</Center>
28+
</Box>
29+
<VStack h="100%" w="30%">
30+
<Box backgroundColor="blue.300" className="fit-parent">
31+
<Center>
32+
<Heading>Stdin</Heading>
33+
</Center>
34+
</Box>
35+
<Box backgroundColor="blue.300" className="fit-parent">
36+
<Center>
37+
<Heading>stdout/stderr</Heading>
38+
</Center>
39+
</Box>
40+
<Box backgroundColor="blue.300" h="10%" w="100%">
41+
<Center>
42+
<Heading>Submit/try</Heading>
43+
</Center>
44+
</Box>
45+
</VStack>
46+
</HStack>
47+
</>
48+
);
49+
};
50+
51+
export default ViewQuestion;

0 commit comments

Comments
 (0)