diff --git a/src/Components/MyPage/PageContent.jsx b/src/Components/MyPage/PageContent.jsx
index a643101..7db9244 100644
--- a/src/Components/MyPage/PageContent.jsx
+++ b/src/Components/MyPage/PageContent.jsx
@@ -1,11 +1,10 @@
import React from 'react';
-import { useNavigate } from 'react-router-dom';
import styled from 'styled-components';
-import PropTypes from 'prop-types';
+import propTypes from 'prop-types';
import Tag from '../Common/Tag';
import Button from '../Common/Button';
-// import Colors from '../../Assets/Colors/Colors';
-// 안녕하세요 ㅇㅇ님이랑 버튼 묶는 헤더
+import Inputs, { InputNum } from '../Common/Inputs';
+
const Header = styled.div`
display: flex;
justify-content: space-between;
@@ -26,6 +25,7 @@ const Info = styled.p`
const Wrapper = styled.div`
display: flex;
justify-content: space-between;
+ align-items: center;
flex-wrap: wrap;
width: 90%;
`;
@@ -34,23 +34,37 @@ const Wrapper = styled.div`
// span은 받아오는 데이터값
const Container = styled.div`
width: 500px;
- font-size: 1.4rem;
+ /* height: 45px; */
+ font-size: 1.2rem;
+ margin-bottom: 20px;
span:nth-child(1) {
font-weight: 700;
+ font-size: 1.2rem;
+ display: inline-block;
+ width: 140px;
+ padding: 0;
+ margin: 0;
}
span:nth-child(2) {
- display: block;
- padding: 30px 0;
+ display: inline-block;
+ font-size: 1.2rem;
+ padding: 0;
+ margin: 0;
}
`;
// 각각 하양송이, 아이디값, 핸드폰번호값, 날짜 받아오기 => 태그는...
// eslint-disable-next-line react/prop-types
-const Contents = ({ userName, userID, userNumber, userStep, userDate }) => {
- const navigate = useNavigate();
- const routeChange = () => {
- navigate('./modifypage');
- };
+const Contents = ({
+ userName,
+ userID,
+ userNumber,
+ userStep,
+ userDate,
+ editFunc,
+ editState,
+ inputFunc,
+}) => {
return (
@@ -59,40 +73,80 @@ const Contents = ({ userName, userID, userNumber, userStep, userDate }) => {
Content="내 정보 수정하기"
width="100%"
Height="50px"
- ClickFunc={routeChange}
+ ClickFunc={editFunc}
/>
-
- 아이디
- {userID}
-
-
- 휴대폰번호
- {userNumber}
-
-
- 백신접종여부
-
-
-
-
-
- 마지막 접종일
- {userDate}
-
+ {editState ? (
+
+ ) : (
+
+ 아이디
+ {userID}
+
+ )}
+ {editState ? (
+
+ ) : (
+
+ 휴대폰 번호
+ {userNumber}
+
+ )}
+ {editState ? (
+
+ ) : (
+
+ 예방접종 내역
+ {userStep}
+
+ )}
+ {editState ? (
+
+ ) : (
+
+ 예방접종 내역
+ {userDate}
+
+ )}
);
};
-// eslint-disable-next-line react/no-typos
-Contents.PropTypes = {
- userName: PropTypes.string.isRequired,
- userID: PropTypes.string.isRequired,
- userNumber: PropTypes.string.isRequired,
- userStep: PropTypes.number.isRequired,
- userDate: PropTypes.string.isRequired,
+Contents.propTypes = {
+ userName: propTypes.string.isRequired,
+ userID: propTypes.string.isRequired,
+ userNumber: propTypes.string.isRequired,
+ userStep: propTypes.number.isRequired,
+ userDate: propTypes.string.isRequired,
+ editFunc: propTypes.func.isRequired,
+ editState: propTypes.bool.isRequired,
+ inputFunc: propTypes.func.isRequired,
};
export default Contents;
diff --git a/src/Layouts/Join/Join.jsx b/src/Layouts/Join/Join.jsx
index 282e091..089094d 100644
--- a/src/Layouts/Join/Join.jsx
+++ b/src/Layouts/Join/Join.jsx
@@ -4,9 +4,10 @@
import React, { useState } from 'react';
import Contents from '../../Components/Join/Contents';
import { userJoin } from '../../api/User';
-// import { useNavigate } from 'react-router-dom';
+import { useNavigate } from 'react-router-dom';
const Join = () => {
+ const navigate = useNavigate();
// input 관련 로직
const [inputs, setinputs] = useState({});
@@ -32,6 +33,7 @@ const Join = () => {
try {
// api 통신
await userJoin(values);
+ navigate('/');
} catch (error) {
alert('입력 사항을 확인하고 다시 회원가입을 해주세요.');
}
diff --git a/src/Layouts/MyPage/MyPage.jsx b/src/Layouts/MyPage/MyPage.jsx
index e6f6b7d..4105128 100644
--- a/src/Layouts/MyPage/MyPage.jsx
+++ b/src/Layouts/MyPage/MyPage.jsx
@@ -1,6 +1,5 @@
-/* eslint-disable import/named */
/* eslint-disable no-unused-vars */
-import React from 'react';
+import React, { useState } from 'react';
import { useRecoilValue } from 'recoil';
import Contents from '../../Components/MyPage/PageContent';
import { UserData, UserInfo } from '../../Recoil/User';
@@ -8,6 +7,25 @@ import { UserData, UserInfo } from '../../Recoil/User';
const MyPage = () => {
const user = useRecoilValue(UserData);
const profile = useRecoilValue(UserInfo);
+
+ // input 관련 로직
+ const [inputs, setinputs] = useState({});
+
+ // edit on/off
+ const [IsEdit, setIsEdit] = useState(false);
+ // edit button toggle event
+ const toggleEdit = () => {
+ setIsEdit(true);
+ console.log(IsEdit);
+ };
+
+ const handleInputs = e => {
+ setinputs({
+ ...inputs,
+ [e.target.name]: e.target.value,
+ });
+ };
+
return (
{
userNumber={profile.phone_number}
userStep={profile.vaccine_step}
userDate={profile.vaccine_date}
+ editFunc={toggleEdit}
+ editState={IsEdit}
+ inputFunc={handleInputs}
/>
);
};