Skip to content

Commit

Permalink
Feat mypage put #5
Browse files Browse the repository at this point in the history
  • Loading branch information
gusdn010158 committed Apr 10, 2024
1 parent 7b1835c commit 14196f1
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 83 deletions.
158 changes: 81 additions & 77 deletions src/Lounge/LoungeDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,67 +93,6 @@ function Community() {
<Detailcomponent>{commun.contents}</Detailcomponent>
</CommunityDetail>

{/* <CommunityBottom>
{Community.map((text: string, index: number) => (
<Communityanswer key={index}>
<Answertop>
<Answername>이름</Answername>
<Answersetting>
<div onClick={heartClick}>
{heart ? <CgHeart /> : <FaHeart />}
</div>
/
<div onClick={handleReplyClick}>
<AiOutlineEnter />
</div>
/
<div>
<BiDotsVerticalRounded />
</div>
</Answersetting>
</Answertop>
<Answercomponent>{text}</Answercomponent>
</Communityanswer>
))}
{Reply.map((Text2: string, index: number) => (
<Ca key={index}>
<BiSubdirectoryRight size="40" />
<Cmanswer>
<Answertop>
<Answername>이름</Answername>
<Answersetting>
<div onClick={heartClick}>
{heart ? <CgHeart /> : <FaHeart />}
</div>
/<BiDotsVerticalRounded />
</Answersetting>
</Answertop>
<Answercomponent>{Text2}</Answercomponent>
</Cmanswer>
</Ca>
))}
{Change && (
<>
<Replyinput
value={ReplyText}
onChange={ReplyChange}
placeholder="내용을 입력하세요"
/>
<ReplyButton onClick={ReplyClick}>대댓글 쓰기 </ReplyButton>
</>
)}
</CommunityBottom> */}

{/* <CommunityMid>
<Communityinput
value={inputText}
onChange={handleChange}
placeholder="내용을 입력하세요"
/>
<CommunityButton onClick={handleClick}>답장하기</CommunityButton>
</CommunityMid> */}
<CommentBox />
</CommunityBox>
</CommunityComponent>
Expand All @@ -170,8 +109,8 @@ const CommunityComponent = styled.div`
`;

const CommunityBox = styled.div`
width: 50%;
min-height: 90vh;
width: 950px;
min-height: 100vh;
padding-top: 30px;
margin-top: 70px;
padding-bottom: 30px;
Expand All @@ -185,12 +124,24 @@ const CommunityBox = styled.div`
`;

const CommunityDetail = styled.div`
width: 80%;
width: 750px;
border-radius: 25px;
padding: 50px;
height: 500px;
background-color: white;
`;
const Detailtop = styled.div`
display: flex;
height: 70px;
justify-content: space-between;
`;

const Detailtitle = styled.div`
font-size: 25px;
`;

const Detailname = styled.div``;
const Detailcomponent = styled.div``;

const Communityinput = styled.input`
height: 70px;
Expand Down Expand Up @@ -238,19 +189,6 @@ const Communityanswer = styled.div`
background-color: white;
`;

const Detailtop = styled.div`
display: flex;
height: 70px;
justify-content: space-between;
`;

const Detailtitle = styled.div`
font-size: 25px;
`;

const Detailname = styled.div``;
const Detailcomponent = styled.div``;

const Answertop = styled.div`
display: flex;
padding: 10px;
Expand Down Expand Up @@ -278,3 +216,69 @@ const Ca = styled.div`
justify-content: space-around;
align-items: center;
`;

{
/* <CommunityBottom>
{Community.map((text: string, index: number) => (
<Communityanswer key={index}>
<Answertop>
<Answername>이름</Answername>
<Answersetting>
<div onClick={heartClick}>
{heart ? <CgHeart /> : <FaHeart />}
</div>
/
<div onClick={handleReplyClick}>
<AiOutlineEnter />
</div>
/
<div>
<BiDotsVerticalRounded />
</div>
</Answersetting>
</Answertop>
<Answercomponent>{text}</Answercomponent>
</Communityanswer>
))}
{Reply.map((Text2: string, index: number) => (
<Ca key={index}>
<BiSubdirectoryRight size="40" />
<Cmanswer>
<Answertop>
<Answername>이름</Answername>
<Answersetting>
<div onClick={heartClick}>
{heart ? <CgHeart /> : <FaHeart />}
</div>
/<BiDotsVerticalRounded />
</Answersetting>
</Answertop>
<Answercomponent>{Text2}</Answercomponent>
</Cmanswer>
</Ca>
))}
{Change && (
<>
<Replyinput
value={ReplyText}
onChange={ReplyChange}
placeholder="내용을 입력하세요"
/>
<ReplyButton onClick={ReplyClick}>대댓글 쓰기 </ReplyButton>
</>
)}
</CommunityBottom> */
}

{
/* <CommunityMid>
<Communityinput
value={inputText}
onChange={handleChange}
placeholder="내용을 입력하세요"
/>
<CommunityButton onClick={handleClick}>답장하기</CommunityButton>
</CommunityMid> */
}
14 changes: 12 additions & 2 deletions src/MyPage/MyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ interface Frined {
name: string;
}
const MyPage = () => {
const friendDelete = () => {
const friendDelete = async (id: number) => {
await axios.delete(`http://localhost:3001/MyPage/${id}`);
alert("삭제되었습니다.");
// 삭제 후 친구 목록을 다시 불러와서 상태를 업데이트합니다.
axios
.get("http://localhost:3001/MyPage")
.then((response) => {
setFriend(response.data);
})
.catch((error) => {
console.log(error);
});
};

const [friend, setFriend] = useState<Frined[]>();
Expand Down Expand Up @@ -52,7 +62,7 @@ const MyPage = () => {
<MPBfriendName>{fr.name}</MPBfriendName>
<MPBbottomBUTTON>
<MPBfriendPage to="/">친구 페이지</MPBfriendPage>
<MPBfriendContentButton onClick={friendDelete}>
<MPBfriendContentButton onClick={() => friendDelete(fr.id)}>
친구 삭제
</MPBfriendContentButton>
</MPBbottomBUTTON>
Expand Down
24 changes: 20 additions & 4 deletions src/json-server/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"name": "강서쪽 사람"
},
{
"id": "3",
"id": "5",
"name": "강서쪽 사람"
},
{
"id": "3",
"id": "4",
"name": "강서쪽 사람"
}
],
Expand Down Expand Up @@ -376,5 +376,21 @@
]
}
],
"Posts": []
}
"Posts": [
{
"id": "97ff",
"content": "asasasasasasasasasasasasasasasasas",
"replies": []
},
{
"id": "8a1b",
"content": "ㅁㄴㅇㄴㅇㅁㄴㅇㅇㅁㅇㅁㄴ",
"replies": []
},
{
"id": "1f45",
"content": "ㅁㄴㅇㅁㄴ",
"replies": []
}
]
}

0 comments on commit 14196f1

Please sign in to comment.