Skip to content

Commit 4f79e77

Browse files
committed
Add non-functional delete button
Awaiting merge to add delete function
1 parent 7ce889b commit 4f79e77

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

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

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
import { Question, StatusBody, Difficulty } from "@/api/structs";
1+
'use client';
2+
import { Question, Difficulty } from "@/api/structs";
23
import Chip from "@/components/shared/Chip";
4+
import PeerprepButton from "@/components/shared/PeerprepButton";
35
import styles from '@/style/question.module.css';
46

57
interface Props {
68
question : Question;
79
}
810

9-
const difficultyColor = (diff: Difficulty) => {
11+
interface DifficultyChipProps {
12+
diff: Difficulty
13+
}
14+
15+
function DifficultyChip({ diff }: DifficultyChipProps) {
1016
return (
1117
diff === Difficulty.Easy
1218
? <Chip className={styles.easy}>Easy</Chip>
@@ -30,10 +36,23 @@ function QuestionBlock({ question }: Props) {
3036
<>
3137
<div className={styles.qn_container}>
3238
<div className={styles.title_wrapper}>
33-
<h1 className={styles.title}>Q{question.id}: {question.title}</h1>
34-
{difficultyColor(question.difficulty)}
39+
<div className={styles.label_wrapper}>
40+
<h1 className={styles.title}>Q{question.id}: {question.title}</h1>
41+
<DifficultyChip diff={question.difficulty} />
42+
</div>
43+
<PeerprepButton className={` ${styles.button}`}
44+
onClick={/* TODO: Replace this function with gateway.delete*/() => console.log("Delete Me!")}>
45+
Delete
46+
</PeerprepButton>
47+
</div>
48+
<div className={styles.label_wrapper}>
49+
<p>Categories: </p>
50+
{question.categories.length == 0
51+
? (<p>No categories listed.</p>)
52+
: question.categories.map((elem, idx) => (
53+
<p key={idx}>{elem}</p>
54+
))}
3555
</div>
36-
<br/>
3756
<p>{question.description}</p>
3857
<br/>
3958
{question.test_cases && (

peerprep/style/question.module.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,24 @@
2525
justify-content: space-between;
2626
align-items: center;
2727
width: 100%;
28+
padding: 0px 5px 0px 0px;
29+
}
30+
31+
.label_wrapper {
32+
display: flex;
33+
flex-direction: row;
34+
justify-content: flex-start;
35+
align-items: center;
36+
gap: 15px;
37+
width: 100%;
2838
padding: 0px 5px;
2939
}
3040

41+
.button {
42+
padding: 4px;
43+
font-size: smaller;
44+
}
45+
3146
.title {
3247
font-size: large;
3348
font-family: Helvetica, Arial, sans-serif;

0 commit comments

Comments
 (0)