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 { body {
margin: 0; margin: 0;
padding: 20px 0;
font-family: 'Fira Code', monospace; font-family: 'Fira Code', monospace;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
height: 100vh; height: 100vh;
background-color: #EEEEEE;
} }
code { code {

View file

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

View file

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