Skip to content

Commit

Permalink
feat: 구매자는 라디오 선택할 수 없도록
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhyojeong committed Jan 29, 2024
1 parent 50b1f9f commit 4e55f9f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
21 changes: 15 additions & 6 deletions src/components/post/PriceOfferCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ const PriceOfferCard = ({
}

const handleChangeOffer = (e: ChangeEvent<HTMLFormElement>) => {
if (!isSeller) {
return
}

const offerId = Number(e.target.value)

setSelectedOffer(offerId)
Expand Down Expand Up @@ -165,12 +169,17 @@ const PriceOfferCard = ({
const isSelected = selectedOffer === id

return (
<Styled.Offer key={id} isSelected={isSelected}>
<Radio.Input
checked={isSelected}
formName="offer"
value={String(id)}
/>
<Styled.Offer
key={id}
isSelected={isSeller && isSelected}
isSeller={isSeller}>
{isSeller && (
<Radio.Input
checked={isSelected}
formName="offer"
value={String(id)}
/>
)}
<Styled.OfferContent>
<UserProfile
date={getTimeDiffText(date)}
Expand Down
9 changes: 7 additions & 2 deletions src/components/post/PriceOfferCard/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,17 @@ const BlankCard = styled.div`
height: 120px;
padding: 20px 0;
`
const Offer = styled(Radio.Label)<{ isSelected: boolean }>`
const Offer = styled(Radio.Label)<{ isSeller: boolean; isSelected: boolean }>`
display: flex;
align-items: center;
padding: 20px;
border-radius: ${({ theme }): string => theme.radius.round6};
${({ theme, isSeller }) =>
css`
border-radius: ${theme.radius.round6};
cursor: ${isSeller ? 'cursor' : 'default'};
`};
${({ theme, isSelected }) => css`
border: solid 1px
Expand Down

0 comments on commit 4e55f9f

Please sign in to comment.