init
This commit is contained in:
42
src/features/teams/components/team-list.tsx
Normal file
42
src/features/teams/components/team-list.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Group, List, ListItem, Skeleton, Stack, Text } from "@mantine/core";
|
||||
import Avatar from "@/components/avatar";
|
||||
import { Team } from "@/features/teams/types";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
|
||||
interface TeamListProps {
|
||||
teams: Team[];
|
||||
loading?: boolean;
|
||||
}
|
||||
|
||||
const TeamList = ({ teams, loading = false }: TeamListProps) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
if (loading) return <List>
|
||||
{Array.from({ length: 10 }).map((_, i) => (
|
||||
<ListItem py='xs'
|
||||
icon={<Skeleton height={40} width={40} />}
|
||||
>
|
||||
<Skeleton height={35} width={200} />
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
|
||||
return <List>
|
||||
{teams?.map((team) => (
|
||||
<ListItem key={team.id}
|
||||
py='xs'
|
||||
icon={<Avatar radius='sm' size={40} name={`${team.name}`} />}
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => navigate({ to: `/teams/${team.id}` })}
|
||||
>
|
||||
<Stack gap={0}>
|
||||
<Text fw={500}>{`${team.name}`}</Text>
|
||||
{team.players?.map(p => <Text size='xs' c='dimmed'>{p.first_name} {p.last_name}</Text>)}
|
||||
</Stack>
|
||||
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
}
|
||||
|
||||
export default TeamList;
|
||||
22
src/features/teams/components/team-profile/header.tsx
Normal file
22
src/features/teams/components/team-profile/header.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Flex, Title } from "@mantine/core";
|
||||
import Avatar from "@/components/avatar";
|
||||
import { Team } from "../../types";
|
||||
|
||||
interface HeaderProps {
|
||||
team: Team;
|
||||
}
|
||||
|
||||
const Header = ({ team }: HeaderProps) => {
|
||||
return (
|
||||
<>
|
||||
<Flex px='xl' w='100%' align='self-end' gap='md'>
|
||||
<Avatar radius='sm' name={team.name} size={125} />
|
||||
<Flex align='center' justify='center' gap={4} pb={20} w='100%'>
|
||||
<Title ta='center' order={2}>{team.name}</Title>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</>
|
||||
)
|
||||
};
|
||||
|
||||
export default Header;
|
||||
21
src/features/teams/components/team-profile/index.tsx
Normal file
21
src/features/teams/components/team-profile/index.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Box, Text } from "@mantine/core";
|
||||
import Header from "./header";
|
||||
import TeamList from "@/features/teams/components/team-list";
|
||||
import { Team } from "../../types";
|
||||
import PlayerList from "@/features/players/components/player-list";
|
||||
|
||||
interface ProfileProps {
|
||||
team: Team;
|
||||
}
|
||||
|
||||
const TeamProfile = ({ team }: ProfileProps) => {
|
||||
return <>
|
||||
<Header team={team} />
|
||||
<Box m='sm' mt='lg'>
|
||||
<Text size='xl' fw={600}>Players</Text>
|
||||
<PlayerList players={team.players} />
|
||||
</Box>
|
||||
</>;
|
||||
};
|
||||
|
||||
export default TeamProfile;
|
||||
Reference in New Issue
Block a user