Skip to content

Commit

Permalink
Merge pull request likelion-inha-hackathon-2#112 from abyss-s/main
Browse files Browse the repository at this point in the history
refactor: 버튼 개수가 dom으로 직접 전달되지 않도록 수정
  • Loading branch information
abyss-s authored Aug 1, 2024
2 parents aa3a731 + 5c10f1c commit 8b03484
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/Reservation/Reservation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ const CalendarIcon = styled.img`
margin-top: 3px;
`;

const ButtonsContainer = styled.div`
const ButtonsContainer = styled.div.withConfig({
shouldForwardProp: (prop) => prop !== "buttonCount",
})`
display: ${(props) => (props.buttonCount > 3 ? "grid" : "flex")};
grid-template-columns: ${(props) =>
props.buttonCount > 3 ? "1fr 1fr" : "none"};
Expand Down Expand Up @@ -297,7 +299,7 @@ const Reservation = ({ appointment, onCancel }) => {
</Button>,
].filter(Boolean);

const buttonCount = buttons.length;
const button_count = buttons.length;

return (
<>
Expand All @@ -319,7 +321,9 @@ const Reservation = ({ appointment, onCancel }) => {
</DateInfo>
</TextContainer>
</DogImageContainer>
<ButtonsContainer buttonCount={buttonCount}>{buttons}</ButtonsContainer>
<ButtonsContainer buttonCount={button_count}>
{buttons}
</ButtonsContainer>
</ReservationContainer>

{isEditing && (
Expand Down

0 comments on commit 8b03484

Please sign in to comment.