Skip to content

Commit 986e518

Browse files
authored
Merge pull request #85 from jpcmf/feat/layout-component
Feat/layout component
2 parents 009e84d + daba4ff commit 986e518

File tree

4 files changed

+74
-52
lines changed

4 files changed

+74
-52
lines changed

src/features/dashboard/index.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Box, SimpleGrid, Text } from "@chakra-ui/react";
2+
import { Layout } from "@/shared/components/Layout";
3+
4+
type DashboardProps = {
5+
user: any;
6+
};
7+
8+
export function Dashboard({ user }: DashboardProps) {
9+
return (
10+
<Layout>
11+
<SimpleGrid columns={{ base: 1, md: 2 }} spacing={{ base: 5, lg: 8 }} w="100dvw">
12+
<Box p={["6", "8"]} bg="gray.800" borderRadius={8} flex="50%">
13+
<Text fontSize="lg" fontWeight="bold" mb="4">
14+
Status do cadastro do atleta
15+
</Text>
16+
<Text color="green.400">{user?.name}</Text>
17+
<Text color="green.400">Regular</Text>
18+
</Box>
19+
20+
<Box p={["6", "8"]} bg="gray.800" borderRadius={8} flex="50%">
21+
<Text fontSize="lg" fontWeight="bold" mb="4">
22+
Dados de acesso da semana
23+
</Text>
24+
{user?.name} <br />
25+
{user?.about} <br />
26+
</Box>
27+
28+
<Box p={["6", "8"]} bg="gray.800" borderRadius={8} flex="50%">
29+
<Text fontSize="lg" fontWeight="bold" mb="4">
30+
Documentações
31+
</Text>
32+
<Text color="green.400" as="a" href="#" textDecoration={"underline"}>
33+
Instruções para inscrição em eventos
34+
</Text>
35+
</Box>
36+
37+
<Box p={["6", "8"]} bg="gray.800" borderRadius={8} flex="50%">
38+
<Text fontSize="lg" fontWeight="bold" mb="4">
39+
Taxa de abertura
40+
</Text>
41+
</Box>
42+
</SimpleGrid>
43+
</Layout>
44+
);
45+
}

src/pages/dashboard.tsx

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,11 @@
11
import { useContext } from "react";
22
import { parseCookies } from "nookies";
3-
import { Box, Flex, SimpleGrid, Text } from "@chakra-ui/react";
4-
5-
import { Header } from "@/components/Header";
6-
import { Sidebar } from "@/components/Sidebar";
73
import { AuthContext } from "@/contexts/AuthContext";
4+
import { Dashboard } from "@/features/dashboard";
85

9-
export default function Dashboard() {
6+
export default function DashboardPage() {
107
const { user } = useContext(AuthContext);
11-
12-
return (
13-
<>
14-
<Flex direction="column" h="100vh">
15-
<Header />
16-
<Flex w="100%" my="6" maxWidth={1480} mx="auto" px="6">
17-
<Sidebar />
18-
<SimpleGrid columns={{ base: 1, md: 2 }} spacing={{ base: 5, lg: 8 }} w="100dvw">
19-
<Box p={["6", "8"]} bg="gray.800" borderRadius={8} flex="50%">
20-
<Text fontSize="lg" fontWeight="bold" mb="4">
21-
Status do cadastro do atleta
22-
</Text>
23-
<Text color="green.400">{user?.name}</Text>
24-
<Text color="green.400">Regular</Text>
25-
</Box>
26-
27-
<Box p={["6", "8"]} bg="gray.800" borderRadius={8} flex="50%">
28-
<Text fontSize="lg" fontWeight="bold" mb="4">
29-
Dados de acesso da semana
30-
</Text>
31-
{user?.name} <br />
32-
{user?.about} <br />
33-
</Box>
34-
35-
<Box p={["6", "8"]} bg="gray.800" borderRadius={8} flex="50%">
36-
<Text fontSize="lg" fontWeight="bold" mb="4">
37-
Documentações
38-
</Text>
39-
<Text color="green.400" as="a" href="#" textDecoration={"underline"}>
40-
Instruções para inscrição em eventos
41-
</Text>
42-
</Box>
43-
44-
<Box p={["6", "8"]} bg="gray.800" borderRadius={8} flex="50%">
45-
<Text fontSize="lg" fontWeight="bold" mb="4">
46-
Taxa de abertura
47-
</Text>
48-
</Box>
49-
</SimpleGrid>
50-
</Flex>
51-
</Flex>
52-
</>
53-
);
8+
return <Dashboard user={user} />;
549
}
5510

5611
export const getServerSideProps = async (ctx: any) => {

src/pages/general.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
export default function General() {
1+
import { Layout } from "@/shared/components/Layout";
2+
export default function GeneralPage() {
23
return (
3-
<div>
4-
<h1>General Page</h1>
5-
</div>
4+
<Layout>
5+
<div>
6+
<h1>General Page</h1>
7+
</div>
8+
</Layout>
69
);
710
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Flex } from "@chakra-ui/react";
2+
import { Header } from "@/components/Header";
3+
import { Sidebar } from "@/components/Sidebar";
4+
5+
type LayoutProps = {
6+
children: React.ReactNode;
7+
};
8+
9+
export function Layout({ children }: LayoutProps) {
10+
return (
11+
<Flex direction="column" h="100vh">
12+
<Header />
13+
<Flex w="100%" my="6" maxWidth={1480} mx="auto" px="6">
14+
<Sidebar />
15+
{children}
16+
</Flex>
17+
</Flex>
18+
);
19+
}

0 commit comments

Comments
 (0)