Skip to content

Commit fb3a057

Browse files
authored
Merge pull request #2701 from devtron-labs/feat/login-page-animation
feat: add animation in login and sso variants
2 parents 04b98a7 + e615cc6 commit fb3a057

File tree

3 files changed

+38
-20
lines changed

3 files changed

+38
-20
lines changed

src/components/login/Login.tsx

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useEffect, useState } from 'react'
1818
import { Redirect, Route, Switch, useHistory, useLocation } from 'react-router-dom'
1919

2020
import {
21+
AnimatePresence,
2122
Button,
2223
ButtonComponentType,
2324
ButtonStyleType,
@@ -27,6 +28,7 @@ import {
2728
Host,
2829
Icon,
2930
LoginBanner,
31+
MotionDiv,
3032
SSOProviderIcon,
3133
ToastManager,
3234
ToastVariantType,
@@ -40,7 +42,7 @@ import { importComponentFromFELibrary } from '@Components/common'
4042
import { TOKEN_COOKIE_NAME, URLS } from '../../config'
4143
import { getSSOConfigList } from '../../Pages/GlobalConfigurations/Authorization/SSOLoginServices/service'
4244
import { dashboardAccessed } from '../../services/service'
43-
import { SSOProvider } from './constants'
45+
import { LOGIN_CARD_ANIMATION_VARIANTS, SSOProvider } from './constants'
4446
import { SSOConfigLoginList } from './login.types'
4547
import { LoginForm } from './LoginForm'
4648

@@ -125,10 +127,22 @@ const Login = () => {
125127

126128
const renderSSOLoginPage = () => (
127129
<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+
)}
128142
{loginList
129143
.filter((sso) => sso.active)
130144
.map((item) => (
131-
<div className="login-button" key={item.name}>
145+
<div key={item.name}>
132146
<Button
133147
variant={ButtonVariantType.secondary}
134148
text={`Login with ${item.name}`}
@@ -171,23 +185,35 @@ const Login = () => {
171185
)
172186

173187
const renderLoginContent = () => (
174-
<Switch>
188+
<Switch location={location}>
175189
<Route path={URLS.LOGIN_SSO} component={renderSSOLoginPage} />
176190
<Route path={URLS.LOGIN_ADMIN} component={renderAdminLoginPage} />
177191
<Redirect to={URLS.LOGIN_SSO} />
178192
</Switch>
179193
)
180194

181195
return (
182-
<div className="full-height-width login dc__grid-half bg__secondary">
196+
<div className="full-height-width dc__grid-half bg__secondary">
183197
<div className="flexbox p-12">
184198
<LoginBanner />
185199
</div>
186200
<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">
188202
<div className="flexbox-col">
189203
{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>
191217
</div>
192218
{getTermsAndConditions && getTermsAndConditions()}
193219
</div>

src/components/login/constants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@ export const ssoProviderToDisplayNameMap: Record<SSOProvider, string> = {
5959
[SSOProvider.oidc]: 'OIDC',
6060
[SSOProvider.openshift]: 'OpenShift',
6161
} as const
62+
63+
export const LOGIN_CARD_ANIMATION_VARIANTS = {
64+
initial: { opacity: 0, y: 40, height: 0 },
65+
animate: { opacity: 1, y: 0, height: 'auto' },
66+
exit: { opacity: 0, y: -40, height: 0 },
67+
}

src/components/login/login.scss

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
// Login css
18-
.login {
19-
20-
.login-card__wrapper {
21-
box-shadow: var(--shadow-overlay);
22-
}
23-
24-
.login-button {
25-
.button__secondary--neutral{
26-
color: var(--N900)
27-
}
28-
}
29-
}
30-
3117
// SSO login & GitOps configuration css
3218

3319
.login__btn {

0 commit comments

Comments
 (0)