Skip to content
Merged
10 changes: 5 additions & 5 deletions umc-master/src/components/Modal/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ import { getUsers } from '@apis/profileApi';
interface ProfileModalProps {
isOpen: boolean;
onClose: () => void;
profileImage: string;
}

const ProfileModal: React.FC<ProfileModalProps> = ({ isOpen, onClose }) => {
const ProfileModal: React.FC<ProfileModalProps> = ({ isOpen, onClose, profileImage }) => {
if (!isOpen) return null;
const navigate = useNavigate();
const { clearAuth } = useAuthStore();
const { user, fetchUser } = useUserStore();

useEffect(() => {
fetchUser(); // ์ปดํฌ๋„ŒํŠธ ๋งˆ์šดํŠธ ์‹œ ์‚ฌ์šฉ์ž ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ
fetchUser();
}, []);
getUsers();

Expand All @@ -39,7 +40,7 @@ const ProfileModal: React.FC<ProfileModalProps> = ({ isOpen, onClose }) => {
<CloseIcon />
</CloseButton>
<ProfileWrapper>
<ProfileImage />
<ProfileImage src={profileImage} alt="Profile Image" />
<Typography variant="titleXSmall">{user?.nickname} ๋‹˜</Typography>
</ProfileWrapper>
<MenuList>
Expand Down Expand Up @@ -109,7 +110,7 @@ const ProfileWrapper = styled.div`
padding: 20px 0;
`;

const ProfileImage = styled.div`
const ProfileImage = styled.img`
width: 60px;
height: 60px;
border-radius: 50%;
Expand Down Expand Up @@ -138,7 +139,6 @@ const MenuItem = styled.li`
}
`;

// "๋งˆ์ดํŽ˜์ด์ง€" ๋งํฌ ์ „์šฉ ์ปดํฌ๋„ŒํŠธ
const MenuItemLink = styled(Link)`
display: flex;
align-items: center;
Expand Down
28 changes: 22 additions & 6 deletions umc-master/src/components/NavigationBar/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,34 @@ const NavigationBar: React.FC<NavigationBarProps> = ({ login }) => {
}, []);
getUsers();

const handleNavClick = () => {
window.scrollTo(0, 0);
};

const toggleAlarmModal = () => setIsAlarmModalOpen((prev) => !prev);
const toggleProfileModal = () => setIsProfileModalOpen((prev) => !prev);

return (
<Container>
<Nav>
<LeftSection>
<NavLink to={RoutePaths.MAIN}>
<NavLink to={RoutePaths.MAIN} onClick={handleNavClick}>
<Logo src={LogoImage} alt="Logo" />
</NavLink>
<Typography variant="titleXxSmall">
<MenuItems>
<StyledNavLink to={RoutePaths.MAGAZINE}>๋งค๊ฑฐ์ง„</StyledNavLink>
<StyledNavLink to={RoutePaths.COMMUNITY}>๊ฟ€ํŒ๋‚˜๋ˆ”</StyledNavLink>
<StyledNavLink to={RoutePaths.SAVE_TIP}>์ €์žฅํ•œ ๊ฟ€ํŒ</StyledNavLink>
<StyledNavLink to={RoutePaths.CHALLENGE}>์ฑŒ๋ฆฐ์ง€</StyledNavLink>
<StyledNavLink to={RoutePaths.MAGAZINE} onClick={handleNavClick}>
๋งค๊ฑฐ์ง„
</StyledNavLink>
<StyledNavLink to={RoutePaths.COMMUNITY} onClick={handleNavClick}>
๊ฟ€ํŒ๋‚˜๋ˆ”
</StyledNavLink>
<StyledNavLink to={RoutePaths.SAVE_TIP} onClick={handleNavClick}>
์ €์žฅํ•œ ๊ฟ€ํŒ
</StyledNavLink>
<StyledNavLink to={RoutePaths.CHALLENGE} onClick={handleNavClick}>
์ฑŒ๋ฆฐ์ง€
</StyledNavLink>
</MenuItems>
</Typography>
</LeftSection>
Expand All @@ -63,7 +75,11 @@ const NavigationBar: React.FC<NavigationBarProps> = ({ login }) => {
</Nav>

<AlarmModal isOpen={isAlarmModalOpen} onClose={toggleAlarmModal} />
<ProfileModal isOpen={isProfileModalOpen} onClose={toggleProfileModal} />
<ProfileModal
isOpen={isProfileModalOpen}
onClose={toggleProfileModal}
profileImage={user?.profile_image_url || gray_character}
/>
</Container>
);
};
Expand Down
1 change: 1 addition & 0 deletions umc-master/src/pages/community/components/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ const TipCreateBTN = styled.button`
border-radius: 50px;
margin-top: 24px;
color: ${({ theme }) => theme.colors.text['black']};
cursor: pointer;
`;
4 changes: 2 additions & 2 deletions umc-master/src/pages/saveTip/SaveTipPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ const SaveTipPage: React.FC = () => {
: placeholderImg
}
text={item.title}
likes={item.likes ?? 0}
bookmarks={item.bookmarks ?? 0}
likes={item.likeCount ?? 0}
bookmarks={item.saveCount ?? 0}
date={item.createdAt.slice(0, 10)}
onClick={() => handleCardClick(item.tipId)}
/>
Expand Down
86 changes: 81 additions & 5 deletions umc-master/src/pages/saveTip/components/PostDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,19 @@ const PostDetail: React.FC<PostDetailProps> = ({ detail }) => {

return (
<PostView>
{detail.media.length > 0 && <Img src={detail.media[0].mediaUrl} alt="๊ฒŒ์‹œ๋ฌผ ์ด๋ฏธ์ง€" />}
{detail.media.length > 0 && (
<ImageGrid count={detail.media.length}>
{detail.media.map((item, index) => (
<ImageItem
key={index}
index={index}
count={detail.media.length}
src={item.mediaUrl}
alt={`์ด๋ฏธ์ง€ ${index + 1}`}
/>
))}
</ImageGrid>
)}
<Typography variant="headingXxSmall" style={{ color: theme.colors.primary[900] }}>
{detail.title}
</Typography>
Expand Down Expand Up @@ -98,14 +110,78 @@ const PostView = styled.div`
align-self: stretch;
`;

const Img = styled.img`
const ImageGrid = styled.div<{ count: number }>`
display: grid;
width: 80vw;
height: 360px;
gap: 10px;

${({ count }) =>
count === 1
? `grid-template-columns: 1fr;
grid-auto-rows: 360px;`
: count === 2
? `grid-template-columns: 1fr 1fr;
grid-auto-rows: 360px;`
: count === 3
? `grid-template-columns: repeat(3, 1fr);`
: count === 4
? `
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: auto auto;
grid-template-areas:
"left top right"
"left bottom right";
`
: count === 5
? `
display: grid;
grid-template-columns: 1fr 1fr 1fr;
& > :nth-child(4), & > :nth-child(5) {
grid-column: span 1;
}
`
: `grid-template-columns: repeat(3, 1fr);`}

grid-auto-rows: minmax(180px, auto);
`;

const ImageItem = styled.img<{ index: number; count: number }>`
width: 100%;
border-radius: 20px;
object-fit: cover;
background: #d9d9d9;
`;

${({ count, index }) =>
count === 1
? `height: 360px;`
: count === 4
? index === 0
? `grid-area: left; grid-row: span 2; height: 360px;`
: index === 1
? `grid-area: top; height: 175px;`
: index === 2
? `grid-area: bottom; height: 175px;`
: index === 3
? `grid-area: right; grid-row: span 2; height: 360px;`
: ''
: // TODO: ์ˆ˜์ •
// count === 5
// ? index === 0
// ? `grid-area: left; grid-row: span 2; height: 360px;`
// : index === 1
// ? `grid-area: top; height: 175px;`
// : index === 2
// ? `grid-area: bottom-left; grid-column: span 1; height: 175px;`
// : index === 3
// ? `grid-area: bottom-right; grid-column: span 1; height: 175px;`
// : index === 4
// ? `grid-area: right; grid-row: span 2; height: 360px;`
// : ''
count === 5
? index < 3
? `grid-column: span 1; height: 360px;`
: `grid-column: span 2; height: 360px;`
: `aspect-ratio: 16/9;`}
`;
const PostInfo = styled.div`
display: flex;
justify-content: space-between;
Expand Down