-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPostingpage.js
More file actions
69 lines (60 loc) · 1.98 KB
/
Postingpage.js
File metadata and controls
69 lines (60 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import React, { useState } from "react";
import { CssBaseline, Container, Button, TextField } from "@mui/material";
import MDEditor from '@uiw/react-md-editor';
export default function PostingBubble() {
const [postTitle, setPostTitle] = useState("");
const [contents, setContents] = useState("");
const handleTitleChange = (e) => {
setPostTitle(e.target.value);
};
const handleContentChange = (value) => {
setContents(value);
};
const handleSubmit = () => {
// 제출 로직을 구현하시면 됩니다. 예를 들어, 콘솔에 제목과 내용을 출력하는 방식으로 구현합니다.
console.log("제목:", postTitle);
console.log("내용:", contents);
// 실제 서버로 데이터를 전송하거나 다른 작업을 수행할 수 있습니다.
};
return (
<React.Fragment>
<CssBaseline />
<Container component="main" maxWidth="md" sx={{ mt: 5, textAlign: 'center', height: '100vh' }}>
<TextField
label="제목"
variant="outlined"
fullWidth
sx={{ mb: 3 }}
value={postTitle}
onChange={handleTitleChange}
/>
<MDEditor
value={contents}
onChange={handleContentChange}
height={400}
/>
<div className="markdownDiv" data-color-mode="light" style={{padding:15}}>
<MDEditor.Markdown
style={{ padding: 10 }}
source={contents} // 마크다운 뷰어에는 작성한 내용을 보여줍니다.
/>
</div>
<Button
variant="contained"
onClick={handleSubmit}
sx={{
mt: 3,
padding: "0.3rem 1.5rem",
backgroundColor: "#1B730E", //"#1B730E"->이게 그릭 로고 글자색상!!
color: "white",
"&:hover": {
backgroundColor: "#1B730E",
},
}}
>
작성하기
</Button>
</Container>
</React.Fragment>
);
}