Skip to content

Commit

Permalink
Merge pull request #12 from SayisMe/dev
Browse files Browse the repository at this point in the history
Feat: DR 사진let 추가
  • Loading branch information
SayisMe authored Jul 6, 2023
2 parents 9b31200 + 9fea4eb commit 9cb8a8d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/diary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// diary.tsx

import { useState } from "react";
import { useState, useEffect } from "react";
import html2canvas from "html2canvas";

// selectedUSer 받아와서 return !
Expand All @@ -11,7 +11,19 @@ const Diary = ({ selectedUser }) => {
const [isTextEditMode, setIsTextEditMode] = useState(false);
const [isTitleEditMode, setIsTitleEditMode] = useState(false);
const [isEditMode, setIsEditMode] = useState(false);
const [imageData, setImageData] = useState([]);

useEffect(() => {
fetch(`http://3.38.118.228:8080/api/imageLet/${selectedUser.kakaoId}`)
.then(response => response.json())
.then(data => {
setImageData(data);
})
.catch(error => {
console.error('Error:', error);
});
}, []);

const handleTextChange = (event) => {
setEditableText(event.target.value);
};
Expand Down Expand Up @@ -116,6 +128,13 @@ const Diary = ({ selectedUser }) => {
{user.bodyText}
</p>
)}
{imageData &&
<div className="imageContainer">
{imageData.map((item, index) => (
<img key={index} src={item.imageUrl} alt={`Image ${index}`} />
))}
</div>
}

{!isEditMode &&
<>
Expand Down
15 changes: 15 additions & 0 deletions src/users.css
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,21 @@
background-color: #b0b0b0;
}

.imageContainer {
width: auto;
padding: 0px 20px 20px;
display: flex;
align-self: center;
overflow-x: auto;
gap: 10px;
}

.imageContainer img {
width: 30%;
height: 30%;
align-self: center;
}

/* 모바일 환경에서의 스타일 조정 */
@media (max-width: 768px) {

Expand Down

0 comments on commit 9cb8a8d

Please sign in to comment.