This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
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.
- Loading branch information
Showing
8 changed files
with
295 additions
and
23 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
41 changes: 41 additions & 0 deletions
41
app/routes/_procted+/lectures+/$lectureId+/_layout/BlankPreviewModal.tsx
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,41 @@ | ||
import Modal from "~/components/Modal"; | ||
import CodeBlank from "~/components/CodeBlank"; | ||
import { codeHole, parsedCodeElement } from "~/util/codeHole"; | ||
import toast from "react-hot-toast"; | ||
|
||
interface Props { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
codeString: string; | ||
language: string; | ||
} | ||
|
||
const BlankPreviewModal = ({ | ||
isOpen, | ||
onClose, | ||
codeString, | ||
language, | ||
}: Props) => { | ||
let parsedCode: parsedCodeElement[][]; | ||
try { | ||
parsedCode = codeHole(codeString, language); | ||
} catch (error) { | ||
toast.error( | ||
"올바르게 빈칸을 렌더링 할 수 없습니다. 코드를 다시 확인해주세요" | ||
); | ||
onClose(); | ||
return null; | ||
} | ||
return ( | ||
<Modal | ||
title="빈칸 미리보기" | ||
subtitle="빈칸이 의도한대로 나오는지 미리보기" | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
> | ||
<CodeBlank parsedCode={parsedCode} language={language} /> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default BlankPreviewModal; |
176 changes: 172 additions & 4 deletions
176
app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemAddModal.tsx
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
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
Oops, something went wrong.