Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/#35-Create-a-first-step-to-log-in #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion intranet/src/core/router/app-router.component.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HashRouter as Router, Route, Routes } from 'react-router-dom';

import { SignUpScene } from '#scenes';
import { SignUpScene, SignInScene } from '#scenes';

import { pathRoutes } from './routes';

Expand All @@ -9,6 +9,7 @@ export const AppRouter = () => {
<Router>
<Routes>
<Route path={pathRoutes.root} element={<SignUpScene />} />
<Route path={pathRoutes.signIn} element={<SignInScene />} />
</Routes>
</Router>
);
Expand Down
2 changes: 2 additions & 0 deletions intranet/src/core/router/routes.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
interface PathRoutes {
root: string;
signIn: string;
}

export const pathRoutes: PathRoutes = {
root: '/',
signIn: '/sign-in',
};

interface Routes extends PathRoutes {}
Expand Down
2 changes: 2 additions & 0 deletions intranet/src/layouts/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './sign-up.layout';
export * from './sign-in/sign-in.layout';
export * from './sign-in/sign-in.layout.styles';
15 changes: 15 additions & 0 deletions intranet/src/layouts/sign-in/sign-in.layout.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { css } from '@emotion/css';

import { mainTheme } from '#core/theme';

export const container = css`
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 0 auto;
min-height: 100vh;
width: 90%;
max-width: 380px;
gap: ${mainTheme.spacing(2)};
`;
8 changes: 8 additions & 0 deletions intranet/src/layouts/sign-in/sign-in.layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as classes from './sign-in.layout.styles';

interface Props extends React.PropsWithChildren {}

export const SignInLayout: React.FC<Props> = props => {
const { children } = props;
return <div className={classes.container}>{children}</div>;
};
1 change: 1 addition & 0 deletions intranet/src/pods/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './temporal';
export * from './sign-up';
export * from './sign-in';
1 change: 1 addition & 0 deletions intranet/src/pods/sign-in/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './sign-in.pod';
88 changes: 88 additions & 0 deletions intranet/src/pods/sign-in/sign-in.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import * as React from 'react';
import Box from '@mui/material/Box';
import TextField from '@mui/material/TextField';
import { mainTheme } from '#core/theme/main.theme.js';
import Button from '@mui/material/Button';
import Typography from '@mui/material/Typography';
import FormControl from '@mui/material/FormControl';
import Link from '@mui/material/Link';

interface Props {
handleSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
}

export const SignInComponent: React.FC<Props> = props => {
const { handleSubmit } = props;
const spacing = mainTheme.spacing;

return (
<>
<Box
sx={{
width: '100%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}
>
<Typography
component="h1"
variant="h5"
sx={{
mb: spacing(4),
}}
>
Acceder
</Typography>

<FormControl
component="form"
onSubmit={handleSubmit}
noValidate
sx={{
width: '100%',
}}
>
<TextField
required
fullWidth
id="email"
label="Email"
name="email"
autoComplete="email"
autoFocus
sx={{
mb: spacing(2),
}}
/>

<TextField
required
fullWidth
id="password"
label="Contraseña"
name="password"
autoComplete="current-password"
sx={{
mb: spacing(5),
}}
/>

<Button
type="submit"
fullWidth
variant="contained"
sx={{
mb: spacing(5),
}}
>
Entrar
</Button>
</FormControl>
<Link href="#" variant="body2">
¿Olvidaste tu contraseña?
</Link>
</Box>
</>
);
};
14 changes: 14 additions & 0 deletions intranet/src/pods/sign-in/sign-in.pod.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { SignInComponent } from './sign-in.component';

export const SignInPod: React.FC = () => {
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
const data = new FormData(event.currentTarget);
console.log({
email: data.get('email'),
password: data.get('password'),
});
};

return <SignInComponent handleSubmit={handleSubmit} />;
};
Empty file.
5 changes: 4 additions & 1 deletion intranet/src/pods/sign-up/sign-up.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Typography } from '@mui/material';
import { Button, Typography, Link } from '@mui/material';

import * as classes from './sign-up.styles';

Expand All @@ -15,6 +15,9 @@ export const SignUpComponent: React.FC = () => {
</Button>
<Button variant="contained">Siguiente</Button>
</div>
<Link href="/#sign-in" variant="body2">
¿Ya tienes una cuenta? Sign in
</Link>
</>
);
};
1 change: 1 addition & 0 deletions intranet/src/scenes/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './sign-up.scene';
export * from './sign-in.scene';
10 changes: 10 additions & 0 deletions intranet/src/scenes/sign-in.scene.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { SignInLayout } from '#layouts';
import { SignInPod } from '#pods';

export const SignInScene: React.FC = () => {
return (
<SignInLayout>
<SignInPod />
</SignInLayout>
);
};
57 changes: 42 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.