Skip to content

Commit

Permalink
feat: login시 제안, 좋아요 안보이도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhyojeong committed Jan 29, 2024
1 parent 9800e91 commit 961dc3c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 45 deletions.
62 changes: 33 additions & 29 deletions src/components/post/PriceOfferCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const PriceOfferCard = ({

const offerDisabled =
getPostOffersQuery.data?.offerCountOfCurrentMember ===
getPostOffersQuery.data?.maximumOfferCount || !isLogin
getPostOffersQuery.data?.maximumOfferCount

useEffect(() => {
setLikePost({
Expand Down Expand Up @@ -198,34 +198,38 @@ const PriceOfferCard = ({
</Text>
</Styled.BlankCard>
)}
<Divider />
<Styled.CardFooter>
<Styled.LikeButton disabled={!isLogin} onClick={handleClickLike}>
{likePost.status ? (
<Icon color="brandPrimary" type="heartFill" />
) : (
<Icon color="grayScale90" type="heart" />
)}
<Styled.LikeText>{likePost.count}</Styled.LikeText>
</Styled.LikeButton>
{isSeller ? (
<Styled.MessageButton
disabled={!selectedOffer}
size="large"
onClick={handleClickStartMessage}>
쪽지하기
</Styled.MessageButton>
) : (
<Styled.MessageButton
disabled={offerDisabled}
size="large"
onClick={() => {
offerModal.openModal()
}}>{`가격 제안하기(${
getPostOffersQuery.data?.offerCountOfCurrentMember || 0
}/2)`}</Styled.MessageButton>
)}
</Styled.CardFooter>
{isLogin && (
<>
<Divider />
<Styled.CardFooter>
<Styled.LikeButton onClick={handleClickLike}>
{likePost.status ? (
<Icon color="brandPrimary" type="heartFill" />
) : (
<Icon color="grayScale90" type="heart" />
)}
<Styled.LikeText>{likePost.count}</Styled.LikeText>
</Styled.LikeButton>
{isSeller ? (
<Styled.MessageButton
disabled={!selectedOffer}
size="large"
onClick={handleClickStartMessage}>
쪽지하기
</Styled.MessageButton>
) : (
<Styled.MessageButton
disabled={offerDisabled}
size="large"
onClick={() => {
offerModal.openModal()
}}>{`가격 제안하기(${
getPostOffersQuery.data?.offerCountOfCurrentMember || 0
}/2)`}</Styled.MessageButton>
)}
</Styled.CardFooter>
</>
)}
</Styled.OfferPriceCardWrapper>
<PriceOfferModal
isOpen={offerModal.isOpen}
Expand Down
22 changes: 6 additions & 16 deletions src/components/post/PriceOfferCard/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,24 +178,14 @@ const LikeButton = styled.button`
width: 96px;
height: 64px;
border: ${({ theme }): string => `solid 1px ${theme.colors.grayScale20}`};
${({ theme }) =>
css`
border: solid 1px ${theme.colors.grayScale20};
cursor: pointer;
&:disabled {
${({ theme }) =>
css`
background-color: ${theme.colors.grayScale20};
color: ${theme.colors.white};
background-color: ${theme.colors.white};
`};
svg {
color: ${theme.colors.white};
}
`};
cursor: default;
}
cursor: pointer;
${({ theme }): string => `
${theme.mediaQuery.tablet} {
Expand Down

0 comments on commit 961dc3c

Please sign in to comment.