Improve login responsiveness

This commit is contained in:
Leonardo Murça 2022-06-07 15:05:34 -03:00
parent 89f13961ec
commit 32d9a1ffc3
3 changed files with 33 additions and 20 deletions

View file

@ -1,9 +1,11 @@
body {
margin: 0;
padding: 20px 0;
font-family: 'Fira Code', monospace;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
height: 100vh;
background-color: #EEEEEE;
}
code {

View file

@ -28,13 +28,13 @@ function View({
error,
layoutType,
}) {
const { paper, boxLogo, boxForm } = styles[layoutType];
const { paper, boxLogo, boxForm, logoContainer } = styles[layoutType];
return (
<Fragment>
<Paper sx={paper} elevation={4} variant="elevation">
<Box sx={boxLogo}>
<Container>
<Container sx={logoContainer}>
<img
src={logoImage}
width={layoutType === 'desktop' ? '100' : '70'}
@ -54,6 +54,7 @@ function View({
type="email"
value={email}
onChange={e => onChangeEmail(e.target.value)}
autoFocus
/>
<TextField
id="password"

View file

@ -1,3 +1,4 @@
// ========== Desktop ==========
const desktopPaper = {
width: '950px',
height: '500px',
@ -7,14 +8,6 @@ const desktopPaper = {
textAlign: 'center',
};
const mobilePaper = {
...desktopPaper,
flexDirection: 'column',
height: '700px',
marginLeft: '10px',
marginRight: '10px',
};
const baseBox = {
width: '100%',
height: '100%',
@ -29,12 +22,6 @@ const desktopBoxLogo = {
backgroundColor: 'secondary.main',
};
const mobileBoxLogo = {
...desktopBoxLogo,
height: '45%',
padding: '0',
};
const desktopBoxForm = {
...baseBox,
'> h1, p ': {
@ -49,22 +36,45 @@ const desktopBoxForm = {
},
};
const logoContainerDesktop = {};
const desktop = {
paper: desktopPaper,
boxLogo: desktopBoxLogo,
boxForm: desktopBoxForm,
logoContainer: logoContainerDesktop,
};
// ========== Mobile ==========
const mobilePaper = {
...desktopPaper,
flexDirection: 'column',
height: '700px',
marginLeft: '10px',
marginRight: '10px',
};
const mobileBoxLogo = {
...desktopBoxLogo,
height: '50%',
padding: '0',
};
const mobileBoxForm = {
...desktopBoxForm,
padding: '0 15px',
width: 'fit-content',
};
const desktop = {
paper: desktopPaper,
boxLogo: desktopBoxLogo,
boxForm: desktopBoxForm,
const logoContainerMobile = {
padding: '20px 16px',
};
const mobile = {
paper: mobilePaper,
boxLogo: mobileBoxLogo,
boxForm: mobileBoxForm,
logoContainer: logoContainerMobile,
};
const styles = { desktop, mobile };