@@ -3,7 +3,7 @@ import { jsx, css } from '@emotion/react';
33import { useCallback , useState , useEffect } from 'react' ;
44import { useNavigate } from 'react-router-dom' ;
55import styled from '@emotion/styled' ;
6- import { Image , Text , Icon } from 'components' ;
6+ import { Image , Text } from 'components' ;
77import theme from 'styles/theme' ;
88import { setLike , setDisLike } from 'utils/apis/postApi' ;
99import { setNotification } from 'utils/apis/userApi' ;
@@ -12,6 +12,7 @@ import useScrollPosition from 'hooks/useScrollPosition';
1212import { useUserContext } from 'contexts/UserContext' ;
1313import { IMAGE_URLS } from 'utils/constants/images' ;
1414import displayedAt from 'utils/functions/displayedAt' ;
15+ import IconButton from 'components/basic/Icon/IconButton' ;
1516
1617const PostBody = ( { index, post, isDetailPage = false } ) => {
1718 const { _id : postId , image, likes, comments, createdAt, author } = post || { } ;
@@ -103,12 +104,18 @@ const PostBody = ({ index, post, isDetailPage = false }) => {
103104 < IconButtons >
104105 < IconButton
105106 name = { onHeart ? 'HEART_RED' : 'HEART' } // Todo: 상수화
107+ size = { 22 }
108+ style = { IconButtonStyle }
106109 onClick = { handleClickHeart }
107110 >
108- < IconButtonText > { heartCount } </ IconButtonText >
111+ < Text fontSize = { 16 } style = { IconButtonTextStyle } >
112+ { heartCount }
113+ </ Text >
109114 </ IconButton >
110- < IconButton name = "COMMENT" onClick = { navigateToDetailPage } >
111- < IconButtonText > { comments . length } </ IconButtonText >
115+ < IconButton name = "COMMENT" size = { 22 } onClick = { navigateToDetailPage } >
116+ < Text fontSize = { 16 } style = { IconButtonTextStyle } >
117+ { comments . length }
118+ </ Text >
112119 </ IconButton >
113120 </ IconButtons >
114121 < TextContainer >
@@ -158,38 +165,18 @@ const IconButtons = styled.div`
158165 display: flex;
159166` ;
160167
161- const IconButton = ( { name, children, onClick } ) => {
162- const style = {
163- padding : 0 ,
164- borderRadius : '0' ,
165- marginRight : '16px' ,
166- display : 'flex' ,
167- alignItems : 'center' ,
168- justifyContent : 'center' ,
169- backgroundColor : 'transparent' ,
170- color : theme . color . fontBlack ,
171- } ;
172- return (
173- < button style = { style } onClick = { onClick } >
174- < Icon name = { name } size = { 22 } />
175- { children }
176- </ button >
177- ) ;
168+ const IconButtonStyle = {
169+ marginRight : '16px' ,
170+ color : theme . color . fontBlack ,
178171} ;
179172
180- const IconButtonText = ( { children, ...props } ) => {
181- const style = {
182- color : theme . color . fontBlack ,
183- marginLeft : '8px' ,
184- PointerEvent : 'none' ,
185- lineHeight : '19px' ,
186- transform : 'translateY(-1px)' ,
187- } ;
188- return (
189- < Text fontSize = { 16 } style = { style } { ...props } >
190- { children }
191- </ Text >
192- ) ;
173+ const IconButtonTextStyle = {
174+ fontSize : '16px' ,
175+ color : theme . color . fontBlack ,
176+ marginLeft : '8px' ,
177+ PointerEvent : 'none' ,
178+ lineHeight : '19px' ,
179+ transform : 'translateY(-1px)' ,
193180} ;
194181
195182const TextContainer = styled . div `
0 commit comments