Skip to content

Commit 1fe8098

Browse files
author
Víctor Borrego Pérez
committed
Refactor LoginForm to use classes
1 parent 23350d7 commit 1fe8098

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

hooks/13_LoginForm/src/pages/loginPage.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,19 @@ interface PropsForm {
7474
loginInfo: LoginEntity;
7575
}
7676

77+
// https://material-ui.com/styles/api/#makestyles-styles-options-hook
78+
const useFormStyles = makeStyles(theme =>
79+
createStyles({
80+
formContainer: {
81+
display: "flex",
82+
flexDirection: "column",
83+
justifyContent: "center"
84+
}
85+
})
86+
);
87+
7788
const LoginForm = (props: PropsForm) => {
89+
const classes = useFormStyles();
7890
const { onLogin, onUpdateField, loginInfo } = props;
7991

8092
// TODO: Enhacement move this outside the stateless component discuss why is a good idea
@@ -83,13 +95,7 @@ const LoginForm = (props: PropsForm) => {
8395
};
8496

8597
return (
86-
<div
87-
style={{
88-
display: "flex",
89-
flexDirection: "column",
90-
justifyContent: "center"
91-
}}
92-
>
98+
<div className={classes.formContainer}>
9399
<TextField
94100
label="Name"
95101
margin="normal"

0 commit comments

Comments
 (0)