채지성

writingPage

.writing{
height: 90%;
width: 90%;
max-width: 1024px;
display:grid;
grid-template-rows: 15% 70% 10% ;
margin: 2% 2%;
background-color: #FDF5E6;
}
.writing :nth-child(1) {
display: flex;
justify-content: center;
align-items: center;
}
.writing :nth-child(2) {
display: flex;
justify-content: center;
align-items:flex-start;
padding-top:3%;
}
.writing :nth-child(1) input{
padding: 2%;
width:95%;
height:87%;
font-size: 30px;
}
.writing :nth-child(2) textarea {
padding: 2%;
width:95%;
height:95%;
resize: none;
font-size: 20px;
}
.writing :nth-child(1) input::placeholder{
font-size:40px;
}
.writing :nth-child(3){
display: flex;
justify-content: end;
align-items: flex-end;
}
.writing :nth-child(3) button {
height: 70%;
width: 15%;
margin: 3%;
max-width: 250px;
}
\ No newline at end of file
......
......@@ -3,19 +3,38 @@ import axios from "axios";
import { useEffect, useState } from 'react';
import './Writing.css'
function Writing() {
const postContent = ()=>{
const title = document.getElementById('title').value;
const content = document.getElementById('content').value;
function Writing() {
let postContent = {
"title": title,
"content": content,
"password": '1234',
};
console.log(postContent);
if(postContent.title == '' || postContent.content == ''){
alert('제목과 내용을 모두 적어주세요');
} else {
axios.post('/api/postSave', postContent).then((res)=>{
window.location.href = '/mealtalk';
});
}
}
useEffect(()=>{
}, []);
return (
<div className='writing'>
<div><input id='title' type='text' placeholder='제목' /></div>
<div><textarea id='content'></textarea></div>
<div id='postContent'><button onClick={postContent}>게시글 등록</button></div>
</div>
);
}
//첫번째: 오늘 메뉴/ 두번째: 오늘 메뉴에 대한 이야기/ 세번째: 어제 메뉴에 대한 이야기
export default Writing;
\ No newline at end of file
......
......@@ -6,16 +6,12 @@ import './MainPage.css'
function MainPage() {
const [lunch, setlunch] = useState("");
const [dinner, setdinner] = useState("");
const [list, setList] = useState([]);
let currentYear = new Date().getFullYear();
let currentMonth = new Date().getMonth();
let currentDate = new Date().getDate();
let today = currentYear+'/'+currentMonth+'/'+currentDate;
const todayMealTable = async()=>{
axios.get("/api/todayMenu").then(
(res) => {
......@@ -48,8 +44,7 @@ function MainPage() {
makeTable(dinnerArr, dinnerDom);
}
)
}
};
useEffect(()=>{
todayMealTable();
......
......@@ -15,9 +15,9 @@ code {
*{
margin:0px;
padding:0px;
/*
border-style: solid;
border-color: black;
border-width: 5px;
*/
}
......