-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from boostcampwm2023/85-문제-보기
[#85] 문제 보기
- Loading branch information
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { css } from '@style/css'; | ||
|
||
import { useState } from 'react'; | ||
|
||
import ProblemViewer from '@/components/Problem/ProblemViewer'; | ||
import mockData from '@/mockData.json'; | ||
|
||
const notFoundProblem = { | ||
title: 'Problem Not Found', | ||
timeLimit: 0, | ||
memoryLimit: 0, | ||
content: 'The requested problem could not be found.', | ||
solutionCode: '', | ||
testcases: [], | ||
createdAt: new Date().toISOString(), | ||
}; | ||
|
||
const INITIAL_PROBLEM_ID = 6; | ||
|
||
function ProblemPage() { | ||
const [currentProblemId] = useState(INITIAL_PROBLEM_ID); | ||
const targetProblem = | ||
mockData.problems.find((problem) => problem.id === currentProblemId) || notFoundProblem; | ||
|
||
return ( | ||
<main className={style}> | ||
<span className={problemTitleStyle}>{targetProblem.title}</span> | ||
<ProblemViewer content={targetProblem.content} /> | ||
</main> | ||
); | ||
} | ||
|
||
export default ProblemPage; | ||
|
||
const style = css({ | ||
backgroundColor: '#1e1e1e', | ||
color: '#ffffff', | ||
}); | ||
|
||
const problemTitleStyle = css({ | ||
display: 'inline-block', | ||
height: '50px', | ||
padding: '10px', | ||
borderBottom: '2px solid white', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters