Skip to content

Commit

Permalink
refact: change string buttons to array
Browse files Browse the repository at this point in the history
  • Loading branch information
koremp committed Aug 9, 2024
1 parent e85a7b4 commit 99cf68c
Showing 1 changed file with 11 additions and 26 deletions.
37 changes: 11 additions & 26 deletions src/component/home/HomeButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,22 @@ const Button = styled.button({
export default function HomeButtons({
handleClickAbout,
handleClickCheerSongList,
handleClickSongList,
handleClickMembers,
handleClickAlbum,
}) {
const buttons = [
{text: "About", onClick: handleClickAbout},
{text: "Member", onClick: handleClickMembers},
{text: "Album", onClick: handleClickAlbum},
{text: "Cheer Song", onClick: handleClickCheerSongList},
]
return (
<Container>
<Button
onClick={handleClickAbout}
>
About
</Button>
<Button
onClick={handleClickMembers}
>
Member
</Button>
<Button
onClick={handleClickAlbum}
>
to Album
</Button>
<Button
onClick={handleClickSongList}
>
Songs
</Button>
<Button
onClick={handleClickCheerSongList}
>
Cheer Song List
</Button>
{
buttons.map(({text, onClick}) =>
<Button onClick={onClick}>{text}</Button>
)
}
</Container>
);
}

0 comments on commit 99cf68c

Please sign in to comment.