Skip to content

Commit

Permalink
Merge pull request #41 from ii-sol/feature/32-mypage
Browse files Browse the repository at this point in the history
feat: 부모님 별명 글자수 제한
  • Loading branch information
jiminpark23 authored Jun 18, 2024
2 parents 5191dbf + 3f0be3d commit 361ee47
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/pages/MyPage/MemberManagement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const MemberManagement = () => {
case 1:
if (!requestData.nickname) {
alert("부모님의 닉네임을 입력해주세요! (ex. 엄마)");
} else if (requestData.nickname.length > 5) {
alert("닉네임은 5글자 이내로 입력해주세요!");
} else {
setStep(step + 1);
}
Expand All @@ -48,10 +50,10 @@ const MemberManagement = () => {
};

const handleInputChange = (e) => {
const inputValue = e.target.value.slice(0, 5);
const value = e.target.value;
setRequestData({
...requestData,
nickname: inputValue,
nickname: value,
});
};

Expand Down Expand Up @@ -96,7 +98,7 @@ const MemberManagement = () => {
<Img src={NicknameImage} alt="nickname" />
</CompleteContainer>
<StyledInputWrapper>
<StyledInput placeholder="부모님을 뭐라고 부를까요?" onChange={handleInputChange} value={requestData.content}></StyledInput>
<StyledInput placeholder="부모님을 뭐라고 부를까요?" onChange={handleInputChange} value={requestData.nickname} maxLength={5}></StyledInput>
</StyledInputWrapper>
</S.StepWrapper>
)}
Expand All @@ -121,6 +123,11 @@ const MemberManagement = () => {

export default MemberManagement;

const Icon = styled.img`
width: 24px;
height: auto;
`;

const SearchWrapper = styled.div`
display: flex;
width: 100%;
Expand All @@ -132,11 +139,6 @@ const SearchWrapper = styled.div`
margin: 10px 0;
`;

const Icon = styled.img`
width: 24px;
height: auto;
`;

const Search = styled.input`
background-color: #f2f2f2;
border-radius: 15px;
Expand Down

0 comments on commit 361ee47

Please sign in to comment.