Skip to content

Commit 8145fc0

Browse files
authored
Merge pull request #93 from CS3219-AY2324S1/92-fix-newline-character-bug
fix newline bug
2 parents 7111e13 + 2d2b67b commit 8145fc0

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

frontend/src/components/CollabProblemSolverLeft.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ function CollabProblemSolverLeft({questionNumber}: {questionNumber: string}) {
4747
</Typography>
4848
<Divider sx={{ marginBottom: 2, marginTop: 5 }} />
4949
<Typography variant="body1" sx={{ marginBottom: 2, fontSize: '18px' }}>
50-
{question.description}
50+
{question.description.split("\\n").map((s, key) => {
51+
return <p key={key}>{s}</p>;
52+
})}
5153
</Typography>
5254
<Divider sx={{ marginBottom: 10 }} />
5355
<Typography variant="h6" gutterBottom sx={{ fontSize: '18px' }}>

frontend/src/components/ProblemSolverLeft.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ProblemSolverLeft.jsx
2-
import React, {useEffect } from 'react';
2+
import React, { useEffect } from 'react';
33
import { useParams } from 'react-router-dom';
44
import {
55
Paper,
@@ -31,13 +31,13 @@ const ProblemSolverLeft = () => {
3131
// If the question is not found, display a message
3232
return (
3333
<Paper elevation={3} sx={{ flex: 1, display: 'flex', flexDirection: 'column', padding: 2 }}>
34-
<Typography variant="h4" gutterBottom>
35-
Question not found
36-
{questionId}
37-
</Typography>
38-
</Paper>
39-
);
40-
}
34+
<Typography variant="h4" gutterBottom>
35+
Question not found
36+
{questionId}
37+
</Typography>
38+
</Paper>
39+
);
40+
}
4141

4242
return (
4343
<Paper elevation={3} sx={{ flex: 1, display: 'flex', flexDirection: 'column', padding: 2}}>
@@ -46,7 +46,9 @@ const ProblemSolverLeft = () => {
4646
</Typography>
4747
<Divider sx={{ marginBottom: 2, marginTop: 5 }} />
4848
<Typography variant="body1" sx={{ marginBottom: 2, fontSize: '18px' }}>
49-
{question.description}
49+
{question.description.split("\\n").map((s, key) => {
50+
return <p key={key}>{s}</p>;
51+
})}
5052
</Typography>
5153
<Divider sx={{ marginBottom: 10 }} />
5254
<Typography variant="h6" gutterBottom sx={{ fontSize: '18px' }}>
@@ -61,7 +63,7 @@ const ProblemSolverLeft = () => {
6163
<CardMedia
6264
component="img"
6365
alt={`Example ${index + 1}`}
64-
sx={{maxHeight: '100%', width: 'auto' }}
66+
sx={{ maxHeight: '100%', width: 'auto' }}
6567
height="140"
6668
image={example.image}
6769
/>

0 commit comments

Comments
 (0)