Skip to content

Commit 7947f6e

Browse files
committed
Add styling for [question] page
1 parent dbd17f8 commit 7947f6e

File tree

6 files changed

+163
-109
lines changed

6 files changed

+163
-109
lines changed

peerprep/app/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import Link from "next/link";
1+
import { redirect } from "next/navigation";
22

33
export default function Home() {
4-
return <Link href="/questions">Questions</Link>;
4+
redirect(`/questions`);
5+
// return <Link href="/questions">Questions</Link>;
56
}

peerprep/app/questions/[question]/question.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
"use client";
22
import React from "react";
3-
import { Question, Difficulty } from "@/api/structs";
3+
import { Difficulty, Question } from "@/api/structs";
44
import Chip from "@/components/shared/Chip";
55
import PeerprepButton from "@/components/shared/PeerprepButton";
66
import styles from "@/style/question.module.css";
77
import { useRouter } from "next/navigation";
88
import { deleteQuestion } from "@/app/api/internal/questions/helper";
99
import CollabEditor from "@/components/questionpage/CollabEditor";
10-
import DOMPurify from 'dompurify';
11-
10+
import DOMPurify from "dompurify";
1211

1312
interface Props {
1413
question: Question;
@@ -31,18 +30,16 @@ function DifficultyChip({ diff }: DifficultyChipProps) {
3130
function QuestionBlock({ question }: Props) {
3231
const router = useRouter();
3332

34-
35-
3633
const handleDelete = async () => {
3734
if (
3835
confirm(
39-
`Are you sure you want to delete ${question.title}? (ID: ${question.id}) `
36+
`Are you sure you want to delete ${question.title}? (ID: ${question.id}) `,
4037
)
4138
) {
4239
const status = await deleteQuestion(question.id);
4340
if (status.error) {
4441
alert(
45-
`Failed to delete question. Code ${status.status}: ${status.error}`
42+
`Failed to delete question. Code ${status.status}: ${status.error}`,
4643
);
4744
return;
4845
}
@@ -75,16 +72,25 @@ function QuestionBlock({ question }: Props) {
7572
{question.topicTags.length == 0 ? (
7673
<p>No topics listed.</p>
7774
) : (
78-
question.topicTags.map((elem, idx) => <p key={idx}>{elem}</p>)
75+
question.topicTags.map((elem, idx) => (
76+
<p key={idx} className={styles.label_shadow}>
77+
{elem}
78+
</p>
79+
))
7980
)}
8081
</div>
81-
{ <div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(question.content)}} /> }
82+
{
83+
<div
84+
className={styles.editorHTML}
85+
dangerouslySetInnerHTML={{
86+
__html: DOMPurify.sanitize(question.content),
87+
}}
88+
/>
89+
}
8290
<br />
8391
</div>
8492
<div className={styles.editor_container}>
85-
<CollabEditor
86-
question={question}
87-
/>
93+
<CollabEditor question={question} />
8894
</div>
8995
</>
9096
);

peerprep/components/questionpage/CollabEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ interface Props {
4747
}
4848

4949
export default function CollabEditor({ question }: Props) {
50-
const [theme, setTheme] = useState("twilight");
51-
const [fontSize, setFontSize] = useState(16);
50+
const [theme, setTheme] = useState("terminal");
51+
const [fontSize, setFontSize] = useState(18);
5252
const [language, setLanguage] = useState("python");
5353

5454
const handleOnChange = (newValue: string) => {

peerprep/components/shared/TitleBar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import styles from "@/style/layout.module.css";
3+
import Link from "next/link";
34

45
function TitleBar() {
56
return (
@@ -11,7 +12,9 @@ function TitleBar() {
1112
// so theoretically retrieval doesn't actually happen more than once or twice
1213
// in a lifetime
1314
<div className={styles.bar}>
14-
<h1 className={styles.title}>PeerPrep</h1>
15+
<Link href="/" className={"text-3xl font-bold text-black"}>
16+
PeerPrep
17+
</Link>
1518
<div className={styles.circle}>PH</div>
1619
</div>
1720
);

peerprep/style/layout.module.css

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
.bar {
2-
background-color: rgb(206, 229, 255);
3-
display: flex;
4-
justify-content: space-between;
5-
align-items: center;
6-
padding: 1px 5px 1px 5px;
2+
background-color: #f9a8d4;
3+
display: flex;
4+
justify-content: space-between;
5+
align-items: center;
6+
padding: 10px 10px 10px 10px;
77
}
88

99
.main_container {
10-
display: flex;
11-
flex-direction: column;
12-
min-width: 100%;
13-
height: 90%;
14-
overflow-y: scroll;
10+
display: flex;
11+
flex-direction: column;
12+
min-width: 100%;
13+
height: 90%;
14+
overflow-y: scroll;
1515
}
1616

1717
.title {
18-
color: black;
18+
color: black;
1919
}
2020

2121
.circle {
22-
background-color: rgb(66, 93, 66);
23-
border-radius: 50%;
24-
display: flex;
25-
justify-content: center;
26-
align-items: center;
27-
width: 40px;
28-
height: 40px;
22+
background-color: rgb(66, 93, 66);
23+
border-radius: 50%;
24+
display: flex;
25+
justify-content: center;
26+
align-items: center;
27+
width: 40px;
28+
height: 40px;
2929
}
3030

3131
.chip {
32-
font-size: small;
33-
font-family: Helvetica, Arial, sans-serif;
34-
font-weight: bolder;
35-
padding: 1px;
36-
border-radius: 25%;
37-
/* Default Chip CSS*/
38-
background-color: white;
39-
border: 1px solid darkslategray;
40-
color: black;
32+
font-size: small;
33+
font-family: Helvetica, Arial, sans-serif;
34+
font-weight: bolder;
35+
padding: 2px;
36+
border-radius: 25%;
37+
/* Default Chip CSS*/
38+
background-color: white;
39+
border: 1px solid darkslategray;
40+
color: black;
4141
}

0 commit comments

Comments
 (0)