From 1dc0f9288a0fb561c33969c47f50700a9902d611 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Sun, 24 Oct 2021 17:33:56 +0530 Subject: [PATCH] UI improvement in SSO Signed-off-by: Ajay Bura --- src/app/molecules/sso-buttons/SSOButtons.jsx | 38 +++++++------- src/app/molecules/sso-buttons/SSOButtons.scss | 50 ++++++++++++------- 2 files changed, 50 insertions(+), 38 deletions(-) diff --git a/src/app/molecules/sso-buttons/SSOButtons.jsx b/src/app/molecules/sso-buttons/SSOButtons.jsx index 76f865a1..47d001c7 100644 --- a/src/app/molecules/sso-buttons/SSOButtons.jsx +++ b/src/app/molecules/sso-buttons/SSOButtons.jsx @@ -4,6 +4,8 @@ import './SSOButtons.scss'; import { createTemporaryClient, getLoginFlows, startSsoLogin } from '../../../client/action/auth'; +import Text from '../../atoms/text/Text'; + function SSOButtons({ homeserver }) { const [identityProviders, setIdentityProviders] = useState([]); @@ -39,23 +41,15 @@ function SSOButtons({ homeserver }) { }); }, [homeserver]); - // TODO Render all non-icon providers at the end so that they are never inbetween icons. + if (identityProviders.length === 0) return <>; + return (
- {identityProviders.map((idp) => { - if (idp.imageSrc == null || idp.imageSrc === undefined || idp.imageSrc === '') { - return ( - - ); - } - return ( +
+ OR +
+
+ {identityProviders.sort((idp) => !!idp.imageSrc).map((idp) => ( - ); - })} + ))} +
); } @@ -73,12 +67,18 @@ function SSOButtons({ homeserver }) { function SSOButton({ homeserver, id, name, type, imageSrc, }) { + const isImageAvail = !!imageSrc; function handleClick() { startSsoLogin(homeserver, type, id); } return ( - ); } diff --git a/src/app/molecules/sso-buttons/SSOButtons.scss b/src/app/molecules/sso-buttons/SSOButtons.scss index 61d48bc5..76f9b46b 100644 --- a/src/app/molecules/sso-buttons/SSOButtons.scss +++ b/src/app/molecules/sso-buttons/SSOButtons.scss @@ -1,31 +1,43 @@ .sso-buttons { - margin-top: var(--sp-extra-loose); + &__divider { + display: flex; + align-items: center; - display: flex; - justify-content: center; - flex-wrap: wrap; - - &__fallback-text { - margin: var(--sp-tight) 0px; - - flex-basis: 100%; - text-align: center; - - color: var(--bg-primary); - cursor: pointer; + &::before, + &::after { + flex: 1; + content: ''; + margin: var(--sp-tight); + border-bottom: 1px solid var(--bg-surface-border); + } + } + &__container { + margin-bottom: var(--sp-extra-loose); + display: flex; + justify-content: center; + flex-wrap: wrap; } } -.sso-button { - margin-bottom: var(--sp-normal); - - display: flex; +.sso-btn { + margin: var(--sp-tight); + display: inline-flex; justify-content: center; - flex-basis: 20%; cursor: pointer; &__img { - height: var(--av-normal); + height: var(--av-small); + width: var(--av-small); + } + &__text-only { + flex-basis: 100%; + text-align: center; + + margin: var(--sp-tight) 0px; + cursor: pointer; + & .text { + color: var(--tc-link); + } } } \ No newline at end of file