Skip to content

Commit

Permalink
refact: update to use member eng lower name from member id
Browse files Browse the repository at this point in the history
  • Loading branch information
koremp committed Aug 9, 2024
1 parent 8e68b22 commit 3faf010
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/component/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const GroupImage = styled.img({
export default function About({ about, members, handleClick }) {
const {
name,
leader,
debutDate,
genres,
wiki,
Expand Down
13 changes: 7 additions & 6 deletions src/component/MemberList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ import {
} from '../styles/members-container';

export default function MemberList({ members, handleClick }) {
const members1 = members.filter((member) => member.id % 2);
const members2 = members.filter((member) => !(member.id % 2));
const divNum = Math.ceil(members.length / 2);
const first = [...members].slice(0, divNum);
const second = [...members].slice(divNum, members.length);

return (
<MembersRowLayout>
<MembersColumnLayout>
{
members1.map((member) => (
first.map((member) => (
<Member
key={member.id}
key={member.engName}
member={member}
handleClick={handleClick}
/>
Expand All @@ -26,9 +27,9 @@ export default function MemberList({ members, handleClick }) {
</MembersColumnLayout>
<MembersColumnLayout>
{
members2.map((member) => (
second.map((member) => (
<Member
key={member.id}
key={member.engName}
member={member}
handleClick={handleClick}
/>
Expand Down
7 changes: 4 additions & 3 deletions src/component/memberList/Member.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const Description = styled.div({

export default function Member({ member, handleClick }) {
const {
id,
korName,
engName,
country,
Expand All @@ -71,8 +70,10 @@ export default function Member({ member, handleClick }) {
description,
} = member;

const lower = engName.toLowerCase();

function handleClickMember() {
handleClick(`/member/${id}`);
handleClick(`/member/${lower}`);
}

return (
Expand All @@ -83,7 +84,7 @@ export default function Member({ member, handleClick }) {
onClick={handleClickMember}
>
<ProfileImage
src={membersImages[id]}
src={membersImages[lower]}
alt={korName}
/>
<Name>
Expand Down

0 comments on commit 3faf010

Please sign in to comment.