Skip to content

Commit

Permalink
feature/#25/프로젝트 디테일 페이지 제작 및 마크다운 뷰어 추가
Browse files Browse the repository at this point in the history
백틱(`) 논의 필요
  • Loading branch information
kevinmj12 committed Dec 17, 2024
1 parent 4615aa0 commit cb3dc96
Show file tree
Hide file tree
Showing 8 changed files with 343 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as Style from "./styles";

const MDEditor = dynamic(() => import("@uiw/react-md-editor"), { ssr: false });

function MdEditor() {
function MDEditorWriter() {
const [value, setValue] = useState<string>("**프로젝트 소개를 입력하세요**");
const [loading, setLoading] = useState<boolean>(false);
const [isActive, setIsActive] = useState<boolean>(false);
Expand Down Expand Up @@ -45,7 +45,7 @@ function MdEditor() {
(prev) =>
prev.substring(0, cursorPosition) +
`\n![image](https://www.kookmin.ac.kr/content/05sub/style0005/images/sub/ui_5_col_image_3.jpg)\n` +
prev.substring(cursorPosition)
prev.substring(cursorPosition),
);
}
setLoading(false);
Expand Down Expand Up @@ -77,7 +77,7 @@ function MdEditor() {
(prev) =>
prev.substring(0, cursorPosition) +
`\n![image](https://www.kookmin.ac.kr/content/05sub/style0005/images/sub/ui_5_col_image_2.jpg)\n` +
prev.substring(cursorPosition)
prev.substring(cursorPosition),
);
}
setLoading(false);
Expand Down Expand Up @@ -154,4 +154,4 @@ function MdEditor() {
);
}

export default MdEditor;
export default MDEditorWriter;
2 changes: 1 addition & 1 deletion src/components/Newpost/Newpost.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Style from "./styles";
import SelectStackType from "../SelectStackType/SelectStackType";
import NewpostEditor from "./MDEditor/mdeditor";
import NewpostEditor from "./MDEditor/MdeditorWriter";
import { useEffect, useRef, useState } from "react";
import NewpostImages from "./ImageUpload/ImageUpload";
import { useSelectStacks } from "@/stores/selectStackType/selectStacksStore";
Expand Down
24 changes: 24 additions & 0 deletions src/components/Project/MDEditor/MdeditorViewer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import "@uiw/react-md-editor/markdown-editor.css";
import "@uiw/react-markdown-preview/markdown.css";
import styles from "./styles.module.css";
import dynamic from "next/dynamic";
import { testReadme } from "./TestReadme";

const MDEditor = dynamic(() => import("@uiw/react-md-editor"), { ssr: false });

function MDEditorViewer() {
return (
<div>
<MDEditor
className={styles.editor}
preview={"preview"}
hideToolbar={true}
visiableDragbar={false}
tabSize={2}
value={testReadme}
/>
</div>
);
}

export default MDEditorViewer;
273 changes: 273 additions & 0 deletions src/components/Project/MDEditor/TestReadme.ts

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/components/Project/MDEditor/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* 컨테이너 스타일 */
.editor {
min-height: 800px; /* 전체 에디터 높이 지정 */
}

/* MDEditor 내부 스타일 */
.editor :global(.w-md-editor-content) {
min-height: 800px; /* 내용 영역 높이 설정 */
font-size: 16px; /* 글꼴 크기 설정 */
}

.editor :global(.w-md-editor-text-input) {
height: 100%; /* 입력 영역을 꽉 채우도록 설정 */
font-size: 16px; /* 글꼴 크기 설정 */
}
18 changes: 18 additions & 0 deletions src/components/Project/Project.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useRouter } from "next/router";
import MDEditorViewer from "./MDEditor/MdeditorViewer";

export default function ProjectComponents() {
const router = useRouter();
const { id } = router.query;

return (
<div>
<h1> 프로젝트 제목: {id} </h1>
<h1> 사진 사진 사진 사진</h1>
<h1> 링크 링크 링크 </h1>
<h1> Markdown Viewer </h1>

<MDEditorViewer />
</div>
);
}
5 changes: 5 additions & 0 deletions src/pages/project/[id]/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import ProjectComponents from "@/components/Project/Project";

export default function Project() {
return <ProjectComponents />;
}
6 changes: 3 additions & 3 deletions src/styles/mdeditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
}

.w-md-editor-text {
font-size: 21px !important;
line-height: 26px !important;
font-size: 16px !important;
line-height: 20px !important;
}
.wmde-markdown {
font-size: 20px !important;
font-size: 16px !important;
}
.w-md-editor-fullscreen {
height: 100vh !important;
Expand Down

0 comments on commit cb3dc96

Please sign in to comment.