@@ -3,15 +3,30 @@ import { useHistory } from "react-router-dom";
33import { LoginEntity } from "../model/login" ;
44import { isValidLogin } from "../api/login" ;
55import { LoginComponent } from "./login.component" ;
6+ import Card from "@material-ui/core/Card" ;
7+ import CardHeader from "@material-ui/core/CardHeader" ;
8+ import CardContent from "@material-ui/core/CardContent" ;
9+ import createStyles from "@material-ui/styles/createStyles" ;
10+ import makeStyles from "@material-ui/styles/makeStyles" ;
611import { NotificationComponent , SessionContext } from "../common" ;
7- import { light } from "@material-ui/core/styles/createPalette" ;
12+
13+ // https://material-ui.com/styles/api/#makestyles-styles-options-hook
14+ const useFormStyles = makeStyles ( ( theme ) =>
15+ createStyles ( {
16+ card : {
17+ maxWidth : 400 ,
18+ margin : "0 auto" ,
19+ } ,
20+ } )
21+ ) ;
822
923interface Props { }
1024
1125export const LoginContainer : React . FC < Props > = ( props ) => {
1226 const loginContext = React . useContext ( SessionContext ) ;
1327 const history = useHistory ( ) ;
1428 const [ isShowAlert , setShowAlert ] = React . useState ( false ) ;
29+ const classes = useFormStyles ( ) ;
1530
1631 const loginSucceeded = ( isValid : boolean , login : LoginEntity ) => {
1732 if ( isValid ) {
@@ -28,12 +43,17 @@ export const LoginContainer: React.FC<Props> = (props) => {
2843
2944 return (
3045 < >
31- < LoginComponent onLogin = { handleLogin } />
32- < NotificationComponent
33- show = { isShowAlert }
34- message = "Invalid Form"
35- onClose = { ( ) => setShowAlert ( false ) }
36- />
46+ < Card className = { classes . card } >
47+ < CardHeader title = "Login" />
48+ < CardContent >
49+ < LoginComponent onLogin = { handleLogin } />
50+ < NotificationComponent
51+ show = { isShowAlert }
52+ message = "Invalid Form"
53+ onClose = { ( ) => setShowAlert ( false ) }
54+ />
55+ </ CardContent >
56+ </ Card >
3757 </ >
3858 ) ;
3959} ;
0 commit comments