diff --git a/src/App.js b/src/App.js index ddf0dfb..1e0861a 100644 --- a/src/App.js +++ b/src/App.js @@ -7,6 +7,8 @@ import Todo from './component/Todo'; import Dday from './component/Dday'; import Search from './component/Search'; import Dailynote from './component/Dailynote'; +import MyPage from './component/MyPage'; +import EditMyPage from './component/EditMyPage'; function App() { return ( @@ -19,6 +21,8 @@ function App() { + + ); diff --git a/src/EditMyPage.css b/src/EditMyPage.css new file mode 100644 index 0000000..3beaf42 --- /dev/null +++ b/src/EditMyPage.css @@ -0,0 +1,65 @@ +.EditMyPageTitle h1{ + color: #456268; + font-weight: bold; + font-size: 38px; +} +.EditMyPage{ + display: flex; + flex-direction: column; + align-items: center; + margin-top: 100px; +} + +.EditMyPageUser{ + display: flex; + flex-direction: row; + margin-top: 45px; + font-size: 18px; +} +.EditMyPageContent { + display: flex; + flex-direction: column; + margin-left: 40px; +} +.EditMyPageCont{ + margin-bottom: 43px; +} +.EditMyPageInputBtn input{ + padding: 10px; + border-radius: 4px; + border: 1px solid #dee2e6; + outline: none; + font-size: 15px; + width: 250px; +} + +.EditMyPageContentTitle{ + font-size: 20px; + font-weight: bold; + margin-right: 40px; + +} +.EditMyPageContentTitle div{ + margin-bottom: 40px; +} + +.EditMyPageEditBtn{ + color: #456268; + background-color: transparent; + width: 40px; + height: 40px; + font-size: 25px; + border: none; + outline: none; + position: relative; + margin-left: 20px; +} + +.EditMyPageEditBtn :hover { + opacity: 0.5; +} +.EditMyPageInputBtn{ + display: flex; + flex-direction: row; + margin-bottom: 25px; +} diff --git a/src/MyPage.css b/src/MyPage.css new file mode 100644 index 0000000..ad80b69 --- /dev/null +++ b/src/MyPage.css @@ -0,0 +1,65 @@ +.MyPage{ +} +.MyPageContent{ + display: flex; + flex-direction: column; + align-items: center; + margin-top: 30px; +} +.MyPageTitle h1{ + color: #456268; + font-weight: bold; + font-size: 38px; +} +.MyPageImage{ + width: 170px; + height: 170px; + border-radius: 70%; + background-color: white; + overflow: hidden; + margin-top: 45px; +} +.MyPageUser{ + display: flex; + flex-direction: row; + margin-top: 25px; +} +.MyPageUserContent{ + display: flex; + flex-direction: column; + font-size: 18px; + +} +.MyPageUserContent div{ + margin-bottom: 4px; +} + +.MyPageUserContentTitle{ + font-size: 20px; + font-weight: bold; + margin-right: 15px; +} +.MyPageBtns{ + margin-top: 40px; +} +.MyPageBtn { + color:#FCF8EC; + background-color:#456268; + border-color:#456268; + padding: 1rem 1.75rem; + font-size: 1.25rem; + margin-right: 1rem; + display: inline-block; + font-weight: 400; + line-height: 1.5; + text-align: center; + text-decoration: none; + vertical-align: middle; + cursor: pointer; + background-color: #456268; + border: 0.125rem solid transparent; + padding: 0.375rem 0.75rem; + font-size: 1rem; + border-radius: 0.5rem; + } + \ No newline at end of file diff --git a/src/component/EditMyPage.js b/src/component/EditMyPage.js new file mode 100644 index 0000000..de84f43 --- /dev/null +++ b/src/component/EditMyPage.js @@ -0,0 +1,80 @@ +import "../EditMyPage.css" +import React , {useState, useEffect,useCallback} from 'react'; +import axios from "axios"; +import { RiEdit2Fill } from "react-icons/ri"; + +export default function EditMyPage({location}){ + + const id=location.state.id; + const name=location.state.name; + const pw=location.state.pw; + const email=location.state.email; + const major=location.state.major; + + const [newEmail, setNewEmail]=useState(email); + const [newMajor, setNewMajor]=useState(major); + + const changeEmail=useCallback( + (e) => { + setNewEmail(e.target.value); + }, + [] + ); + const changeMajor=useCallback( + (e) => { + setNewMajor(e.target.value); + }, + [] + ); + + const editEmail=(id, {data})=>{ + console.log(data); + axios.post('/mypage/changeEmail',{ + id:id, + newEmail:data, + }) + + + } + const editMajor=(id, {data})=>{ + + axios.post('/mypage/changeMajor',{ + id:id, + newMajor:data, + }) + } + + return( +
+
+

회원정보 수정

+
+
+
+
이름
+
아이디
+
비밀번호
+
이메일
+
전공
+
+
+
{name}
+
{id}
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ ) +} \ No newline at end of file diff --git a/src/component/Home.js b/src/component/Home.js index 4032319..52e168d 100644 --- a/src/component/Home.js +++ b/src/component/Home.js @@ -97,9 +97,11 @@ function Home() {
+ +
{!isLoggedIn ? ( diff --git a/src/component/MyPage.js b/src/component/MyPage.js new file mode 100644 index 0000000..b794bb5 --- /dev/null +++ b/src/component/MyPage.js @@ -0,0 +1,67 @@ +import "../MyPage.css" +import Navbr from "./Navbar"; +import React , {useState, useEffect} from 'react'; +import Axios from 'axios'; +import {Link} from 'react-router-dom'; + +export default function MyPage(){ + const [user,setUser]=useState([]); + + useEffect(() => { + Axios.get("/mypage/info") + .then(res => { + console.log(res.data.data[0]); + setUser(res.data.data[0]); + }) + }, []) + + return( +
+
+ +
+
+
+

My Page

+
+
+ +
+
+
+
이름
+
아이디
+
이메일
+
전공
+
+ +
+
{user.name}
+
{user.id}
+
{user.email}
+
{user.major}
+
+
+ +
+ + + + + + + +
+
+
+ ) +}