Skip to content

Commit 19d5a4a

Browse files
committed
Refactor: Icon 컴포넌트 적용
1 parent 9ff753d commit 19d5a4a

5 files changed

Lines changed: 24 additions & 25 deletions

File tree

src/pages/Post/PostBase/index.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import { postIdAtom, userAtom, isPostRepresentativeAtom } from '@recoil/Post/Pos
1313
import { getCurrentUserId } from '@utils/getCurrentUserId';
1414

1515
import Left from '@assets/arrow/left.svg';
16-
import LikeFill from '@assets/default/like-fill.svg';
17-
import Like from '@assets/default/like.svg';
16+
import Like from '@components/Icons/Like';
1817
import Message from '@assets/default/message.svg';
1918
import More from '@assets/default/more.svg';
2019

@@ -185,16 +184,18 @@ const PostBase: React.FC<PostBaseProps> = ({ onClickMenu }) => {
185184

186185
{!post ? <ImageSkeleton /> : <ImageSwiper images={post.postImages.map((image) => image.url)} />}
187186

188-
<ClothingInfoList className="post-mode">
189-
{post?.postClothings?.map((clothingObj, index) => (
190-
<ClothingInfoItem key={index} clothingObj={clothingObj} />
191-
))}
192-
</ClothingInfoList>
187+
{post?.postClothings && (
188+
<ClothingInfoList className="post-mode">
189+
{post.postClothings.map((clothingObj, index) => (
190+
<ClothingInfoItem key={index} clothingObj={clothingObj} />
191+
))}
192+
</ClothingInfoList>
193+
)}
193194

194195
<IconRow>
195196
<IconWrapper>
196197
<Icon onClick={togglePostLikeStatus}>
197-
{post?.isPostLike ? <img src={LikeFill} alt="like" /> : <img src={Like} alt="like" />}
198+
{post?.isPostLike ? <Like isFilled={true} color={theme.colors.brand.primary} /> : <Like />}
198199
</Icon>
199200
<span onClick={() => handleLikeCommentOpen('likes')}>{post?.postLikesCount ?? 0}</span>
200201
</IconWrapper>

src/pages/Post/PostBase/styles.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,29 +133,28 @@ export const IconRow = styled.div`
133133
height: 20px;
134134
align-items: center;
135135
padding: 0 20px;
136+
gap: 16px;
136137
`;
137138

138139
export const IconWrapper = styled.div`
139140
display: flex;
140141
align-items: center;
141142
gap: 8px;
142143
cursor: pointer;
144+
height: 22px;
143145
144146
span {
145147
font-size: 15px;
146148
color: ${({ theme }) => theme.colors.text.primary};
147-
margin-right: 16px;
148149
}
149150
`;
150151

151152
export const Icon = styled.div`
152-
width: 20px;
153-
height: 20px;
154-
155-
img {
156-
width: 20px;
157-
height: 20px;
158-
}
153+
width: 18px;
154+
height: 18px;
155+
display: flex;
156+
align-items: center;
157+
justify-content: center;
159158
`;
160159

161160
export const ClothingInfoList = styled.div`

src/pages/Post/PostImageSelect/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import {
1414
import { getCurrentUserId } from '@utils/getCurrentUserId';
1515

1616
import Left from '@assets/arrow/left.svg';
17-
import PhotoBig from '@assets/default/photo-big.svg';
1817
import X from '@assets/default/x.svg';
18+
import Photo from '@components/Icons/Photo';
1919

2020
import BottomButton from '@components/BottomButton';
2121
import { OODDFrame } from '@components/Frame/Frame';
@@ -156,7 +156,7 @@ const PostImageSelect: React.FC = () => {
156156
<StyledText $textTheme={{ style: 'heading1-regular', lineHeight: 2 }}>
157157
사진을 여기에 끌어다 놓으세요
158158
</StyledText>
159-
<img src={PhotoBig} />
159+
<Photo height="100px" width="100px" />
160160
<input type="file" onChange={handleFileInputChange} ref={fileInputRef} multiple accept="image/*,.heic" />
161161
</ImageDragDropContainer>
162162
) : (

src/pages/Post/PostUpload/ImageSwiper/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { useRef } from 'react';
2+
import ReactDOMServer from 'react-dom/server';
23

34
import { Navigation, Pagination } from 'swiper/modules';
45
import { Swiper, SwiperRef, SwiperSlide } from 'swiper/react';
56
import 'swiper/css';
67
import 'swiper/css/navigation';
78
import 'swiper/css/pagination';
89

9-
import PhotoWhite from '@assets/default/photo-white.svg';
10+
import Photo from '@components/Icons/Photo';
1011

1112
import type { ImageSwiperProps } from '../dto';
1213

@@ -31,9 +32,10 @@ const ImageSwiper: React.FC<ImageSwiperProps> = ({ images }) => {
3132
el: '.swiper-pagination',
3233
type: 'custom',
3334
renderCustom: (_, current, total) => {
35+
const photoIcon = ReactDOMServer.renderToString(<Photo color="white" />);
3436
return `
3537
<div class="swiper-pagination-custom">
36-
<img src="${PhotoWhite}" alt="Pagination Icon" />
38+
${photoIcon}
3739
<span>${current}/${total}</span>
3840
</div>`;
3941
},

src/pages/Post/PostUpload/ImageSwiper/styles.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const StyledPagination = styled.div`
8282
align-items: center;
8383
width: 65px;
8484
height: 34px;
85-
color: white;
85+
color: ${({ theme }) => theme.colors.text.contrast};
8686
background: ${({ theme }) => theme.colors.brand.gradient};
8787
border-radius: 17px;
8888
@@ -92,11 +92,8 @@ export const StyledPagination = styled.div`
9292
justify-content: center;
9393
}
9494
95-
.swiper-pagination-custom img {
96-
margin-right: 0.3125rem;
97-
}
98-
9995
span {
96+
margin-left: 0.3125rem;
10097
font-family: 'Pretendard Variable';
10198
font-weight: 300;
10299
font-size: 0.8125rem;

0 commit comments

Comments
 (0)