1
- import { makeStyles } from "@mui/styles " ;
2
- import { FormikTouched } from "formik" ;
3
- import { FC , useState } from "react" ;
4
- import { AuthMethods } from "api/typesGenerated" ;
1
+ import { type Interpolation , type Theme } from "@emotion/react " ;
2
+ import { type FormikTouched } from "formik" ;
3
+ import { type FC , useState } from "react" ;
4
+ import type { AuthMethods } from "api/typesGenerated" ;
5
5
import { PasswordSignInForm } from "./PasswordSignInForm" ;
6
6
import { OAuthSignInForm } from "./OAuthSignInForm" ;
7
- import { BuiltInAuthFormValues } from "./SignInForm.types" ;
7
+ import { type BuiltInAuthFormValues } from "./SignInForm.types" ;
8
8
import Button from "@mui/material/Button" ;
9
9
import EmailIcon from "@mui/icons-material/EmailOutlined" ;
10
10
import { Alert } from "components/Alert/Alert" ;
@@ -21,11 +21,11 @@ export const Language = {
21
21
oidcSignIn : "OpenID Connect" ,
22
22
} ;
23
23
24
- const useStyles = makeStyles ( ( theme ) => ( {
24
+ const styles = {
25
25
root : {
26
26
width : "100%" ,
27
27
} ,
28
- title : {
28
+ title : ( theme ) => ( {
29
29
fontSize : theme . spacing ( 4 ) ,
30
30
fontWeight : 400 ,
31
31
margin : 0 ,
@@ -35,34 +35,34 @@ const useStyles = makeStyles((theme) => ({
35
35
"& strong" : {
36
36
fontWeight : 600 ,
37
37
} ,
38
- } ,
39
- alert : {
38
+ } ) ,
39
+ alert : ( theme ) => ( {
40
40
marginBottom : theme . spacing ( 4 ) ,
41
- } ,
42
- divider : {
41
+ } ) ,
42
+ divider : ( theme ) => ( {
43
43
paddingTop : theme . spacing ( 3 ) ,
44
44
paddingBottom : theme . spacing ( 3 ) ,
45
45
display : "flex" ,
46
46
alignItems : "center" ,
47
47
gap : theme . spacing ( 2 ) ,
48
- } ,
49
- dividerLine : {
48
+ } ) ,
49
+ dividerLine : ( theme ) => ( {
50
50
width : "100%" ,
51
51
height : 1 ,
52
52
backgroundColor : theme . palette . divider ,
53
- } ,
54
- dividerLabel : {
53
+ } ) ,
54
+ dividerLabel : ( theme ) => ( {
55
55
flexShrink : 0 ,
56
56
color : theme . palette . text . secondary ,
57
57
textTransform : "uppercase" ,
58
58
fontSize : 12 ,
59
59
letterSpacing : 1 ,
60
- } ,
61
- icon : {
60
+ } ) ,
61
+ icon : ( theme ) => ( {
62
62
width : theme . spacing ( 2 ) ,
63
63
height : theme . spacing ( 2 ) ,
64
- } ,
65
- } ) ) ;
64
+ } ) ,
65
+ } satisfies Record < string , Interpolation < Theme > > ;
66
66
67
67
export interface SignInFormProps {
68
68
isSigningIn : boolean ;
@@ -90,23 +90,22 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
90
90
const passwordEnabled = authMethods ?. password . enabled ?? true ;
91
91
// Hide password auth by default if any OAuth method is enabled
92
92
const [ showPasswordAuth , setShowPasswordAuth ] = useState ( ! oAuthEnabled ) ;
93
- const styles = useStyles ( ) ;
94
93
const applicationName = getApplicationName ( ) ;
95
94
96
95
return (
97
- < div className = { styles . root } >
98
- < h1 className = { styles . title } >
96
+ < div css = { styles . root } >
97
+ < h1 css = { styles . title } >
99
98
Sign in to < strong > { applicationName } </ strong >
100
99
</ h1 >
101
100
102
101
{ Boolean ( error ) && (
103
- < div className = { styles . alert } >
102
+ < div css = { styles . alert } >
104
103
< ErrorAlert error = { error } />
105
104
</ div >
106
105
) }
107
106
108
107
{ Boolean ( info ) && Boolean ( error ) && (
109
- < div className = { styles . alert } >
108
+ < div css = { styles . alert } >
110
109
< Alert severity = "info" > { info } </ Alert >
111
110
</ div >
112
111
) }
@@ -120,10 +119,10 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
120
119
) }
121
120
122
121
{ passwordEnabled && showPasswordAuth && oAuthEnabled && (
123
- < div className = { styles . divider } >
124
- < div className = { styles . dividerLine } />
125
- < div className = { styles . dividerLabel } > Or</ div >
126
- < div className = { styles . dividerLine } />
122
+ < div css = { styles . divider } >
123
+ < div css = { styles . dividerLine } />
124
+ < div css = { styles . dividerLabel } > Or</ div >
125
+ < div css = { styles . dividerLine } />
127
126
</ div >
128
127
) }
129
128
@@ -141,17 +140,17 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
141
140
142
141
{ passwordEnabled && ! showPasswordAuth && (
143
142
< >
144
- < div className = { styles . divider } >
145
- < div className = { styles . dividerLine } />
146
- < div className = { styles . dividerLabel } > Or</ div >
147
- < div className = { styles . dividerLine } />
143
+ < div css = { styles . divider } >
144
+ < div css = { styles . dividerLine } />
145
+ < div css = { styles . dividerLabel } > Or</ div >
146
+ < div css = { styles . dividerLine } />
148
147
</ div >
149
148
150
149
< Button
151
150
fullWidth
152
151
size = "large"
153
152
onClick = { ( ) => setShowPasswordAuth ( true ) }
154
- startIcon = { < EmailIcon className = { styles . icon } /> }
153
+ startIcon = { < EmailIcon css = { styles . icon } /> }
155
154
>
156
155
Email and password
157
156
</ Button >
0 commit comments