@@ -18,6 +18,7 @@ import { useEffect, useState } from 'react'
18
18
import { Redirect , Route , Switch , useHistory , useLocation } from 'react-router-dom'
19
19
20
20
import {
21
+ AnimatePresence ,
21
22
Button ,
22
23
ButtonComponentType ,
23
24
ButtonStyleType ,
@@ -27,6 +28,7 @@ import {
27
28
Host ,
28
29
Icon ,
29
30
LoginBanner ,
31
+ MotionDiv ,
30
32
SSOProviderIcon ,
31
33
ToastManager ,
32
34
ToastVariantType ,
@@ -40,7 +42,7 @@ import { importComponentFromFELibrary } from '@Components/common'
40
42
import { TOKEN_COOKIE_NAME , URLS } from '../../config'
41
43
import { getSSOConfigList } from '../../Pages/GlobalConfigurations/Authorization/SSOLoginServices/service'
42
44
import { dashboardAccessed } from '../../services/service'
43
- import { SSOProvider } from './constants'
45
+ import { LOGIN_CARD_ANIMATION_VARIANTS , SSOProvider } from './constants'
44
46
import { SSOConfigLoginList } from './login.types'
45
47
import { LoginForm } from './LoginForm'
46
48
@@ -125,10 +127,22 @@ const Login = () => {
125
127
126
128
const renderSSOLoginPage = ( ) => (
127
129
< div className = "flexbox-col dc__gap-12 p-36" >
130
+ { initLoading && ! loginList . length && (
131
+ < Button
132
+ variant = { ButtonVariantType . secondary }
133
+ text = "Checking SSO"
134
+ dataTestId = "checking-sso"
135
+ style = { ButtonStyleType . neutral }
136
+ startIcon = { < Icon name = "ic-circle-loader" color = { null } /> }
137
+ fullWidth
138
+ size = { ComponentSizeType . xl }
139
+ disabled
140
+ />
141
+ ) }
128
142
{ loginList
129
143
. filter ( ( sso ) => sso . active )
130
144
. map ( ( item ) => (
131
- < div className = "login-button" key = { item . name } >
145
+ < div key = { item . name } >
132
146
< Button
133
147
variant = { ButtonVariantType . secondary }
134
148
text = { `Login with ${ item . name } ` }
@@ -171,23 +185,35 @@ const Login = () => {
171
185
)
172
186
173
187
const renderLoginContent = ( ) => (
174
- < Switch >
188
+ < Switch location = { location } >
175
189
< Route path = { URLS . LOGIN_SSO } component = { renderSSOLoginPage } />
176
190
< Route path = { URLS . LOGIN_ADMIN } component = { renderAdminLoginPage } />
177
191
< Redirect to = { URLS . LOGIN_SSO } />
178
192
</ Switch >
179
193
)
180
194
181
195
return (
182
- < div className = "full-height-width login dc__grid-half bg__secondary" >
196
+ < div className = "full-height-width dc__grid-half bg__secondary" >
183
197
< div className = "flexbox p-12" >
184
198
< LoginBanner />
185
199
</ div >
186
200
< div className = "flex" >
187
- < div className = "login-card__wrapper dc__overflow-hidden br-12 mw-420 bg__primary dc__border" >
201
+ < div className = "shadow__overlay dc__overflow-hidden br-12 mw-420 bg__primary dc__border" >
188
202
< div className = "flexbox-col" >
189
203
{ renderDevtronLogo ( ) }
190
- { renderLoginContent ( ) }
204
+ < AnimatePresence >
205
+ < MotionDiv
206
+ key = { location . pathname }
207
+ variants = { LOGIN_CARD_ANIMATION_VARIANTS }
208
+ initial = "initial"
209
+ animate = "animate"
210
+ exit = "exit"
211
+ transition = { { duration : 0.3 , ease : [ 0.4 , 0 , 0.2 , 1 ] } }
212
+ className = "dc__overflow-hidden"
213
+ >
214
+ { renderLoginContent ( ) }
215
+ </ MotionDiv >
216
+ </ AnimatePresence >
191
217
</ div >
192
218
{ getTermsAndConditions && getTermsAndConditions ( ) }
193
219
</ div >
0 commit comments