Skip to content

Commit

Permalink
rankingからmember/[id]へ飛ぶ
Browse files Browse the repository at this point in the history
  • Loading branch information
nrak126 committed Jun 22, 2024
1 parent c9b4a88 commit 24c649e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
45 changes: 21 additions & 24 deletions src/components/member/RankingCard.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { Avatar, Box, Flex, Text } from "@radix-ui/themes";
import { type ReactElement } from "react";
import styled from "styled-components";
import SampleMembers from "@/assets/members.json";
import { type Member } from "@/types/member";
import { Link } from "@/router";

export function RankingCard({
memberEmail,
memberName,
memberIcon,
index,
point,
}: {
memberEmail: string;
memberName: string;
memberIcon: string;
index: number;
point: number;
}): ReactElement {
const matchMember: Member = SampleMembers.members.find(
(member) => member.email === memberEmail,
);

const BoxStyle = styled(Box)`
border-bottom: 1px solid;
Expand All @@ -25,26 +25,23 @@ export function RankingCard({
`;

return (
<BoxStyle>
<Flex align="center" gap="6" ml="10rem" mr="10rem">
<Text mr="3rem" size="8" weight="bold">
{index + 1}
</Text>
<Avatar
fallback="T"
radius="full"
size="8"
src={matchMember.icon}
/>
<Flex align="center" direction="column">
<Text as="div" size="7" weight="bold">
{matchMember.name}
</Text>
<Text as="div" color="gray" size="7">
{point}pt
<Link params={{ id: memberEmail }} to="/members/:id">
<BoxStyle>
<Flex align="center" gap="6" ml="10rem" mr="10rem">
<Text mr="3rem" size="8" weight="bold">
{index + 1}
</Text>
<Avatar fallback="T" radius="full" size="8" src={memberIcon} />
<Flex align="center" direction="column">
<Text as="div" size="7" weight="bold">
{memberName}
</Text>
<Text as="div" color="gray" size="7">
{point}pt
</Text>
</Flex>
</Flex>
</Flex>
</BoxStyle>
</BoxStyle>
</Link>
);
}
2 changes: 2 additions & 0 deletions src/pages/ranking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export default function Page(): ReactElement {
key={member.email}
index={index}
memberEmail={member.email}
memberIcon={member.icon}
memberName={member.name}
point={member.unlockedCount}
/>
))}
Expand Down

0 comments on commit 24c649e

Please sign in to comment.