Skip to content

Commit

Permalink
auth pages done
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamsMata committed May 2, 2023
1 parent 7802770 commit 3609cf3
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/components/layouts/AuthLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { FC, PropsWithChildren } from "react";
import Head from "next/head";
import { AppBar, Box, Container, Toolbar, Typography } from "@mui/material";
import Link from "../Link";

interface Props extends PropsWithChildren {
title: string;
}

export const AuthLayout: FC<Props> = ({ children, title }) => {
return (
<>
<Head>
<title>{title}</title>
</Head>

<AppBar>
<Toolbar component="nav">
<Link href="/" display="flex" alignItems="center">
<Typography variant="h6">Teslo | </Typography>
<Typography sx={{ ml: 0.5 }}>Shop</Typography>
</Link>
</Toolbar>
</AppBar>

<Container component="main">
<Box
display="flex"
justifyContent="center"
alignItems="center"
height="calc(100vh - 160px)"
>
{children}
</Box>
</Container>
</>
);
};
1 change: 1 addition & 0 deletions src/components/layouts/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./AuthLayout";
export * from "./ShopLayout";
37 changes: 37 additions & 0 deletions src/pages/auth/login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { NextPage } from "next";
import { Box, Button, TextField, Typography } from "@mui/material";
import Link from "@/components/Link";
import { AuthLayout } from "@/components/layouts";

const LoginPage: NextPage = () => {
return (
<AuthLayout title="Login">
<Box sx={{ width: 350, px: 2, py: 1 }}>
<Box display="flex" flexDirection="column" gap={2}>
<Typography variant="h1">Login</Typography>

<TextField label="Email" type="email" fullWidth />

<TextField label="Password" type="password" fullWidth />

<Button
color="secondary"
className="circular-btn"
size="large"
fullWidth
>
Login
</Button>

<Box display="flex" justifyContent="end">
<Link href="/auth/register" underline="always">
Create account
</Link>
</Box>
</Box>
</Box>
</AuthLayout>
);
};

export default LoginPage;
39 changes: 39 additions & 0 deletions src/pages/auth/register.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { NextPage } from "next";
import { Box, Button, TextField, Typography } from "@mui/material";
import Link from "@/components/Link";
import { AuthLayout } from "@/components/layouts";

const RegisterPage: NextPage = () => {
return (
<AuthLayout title="Login">
<Box sx={{ width: 350, px: 2, py: 1 }}>
<Box display="flex" flexDirection="column" gap={2}>
<Typography variant="h1">Create account</Typography>

<TextField label="Name" fullWidth />

<TextField label="Email" type="email" fullWidth />

<TextField label="Password" type="password" fullWidth />

<Button
color="secondary"
className="circular-btn"
size="large"
fullWidth
>
Create account
</Button>

<Box display="flex" justifyContent="end">
<Link href="/auth/login" underline="always">
Login
</Link>
</Box>
</Box>
</Box>
</AuthLayout>
);
};

export default RegisterPage;

0 comments on commit 3609cf3

Please sign in to comment.