Added brand logos to login buttons (#479)

* Added brand logos to login buttons

* Addressing changes
This commit is contained in:
darth-coder00 2021-09-13 23:56:41 +05:30 committed by GitHub
parent 36c3e22336
commit 01f6d7089d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -33,30 +33,41 @@ const SigninPage = () => {
}; };
const getSignInButton = (): JSX.Element => { const getSignInButton = (): JSX.Element => {
let ssoBrandName = '';
let ssoBrandLogo = '';
switch (appState.authProvider.provider) { switch (appState.authProvider.provider) {
case AuthTypes.GOOGLE: { case AuthTypes.GOOGLE: {
return ( ssoBrandLogo = Icons.GOOGLE_ICON;
<button className="tw-signin-button"> ssoBrandName = 'Google';
<SVGIcons alt="Google Logo" icon={Icons.GOOGLE_ICON} width="22" />
<span className="tw-ml-3">Sign in with Google</span> break;
</button>
);
} }
case AuthTypes.OKTA: { case AuthTypes.OKTA: {
return ( ssoBrandLogo = Icons.OKTA_ICON;
<button className="tw-signin-button tw-text-white tw-bg-blue-700 hover:tw-bg-blue-600"> ssoBrandName = 'Okta';
Sign in with Okta
</button> break;
);
} }
case AuthTypes.AUTH0: { case AuthTypes.AUTH0: {
return <button className="tw-signin-button">Sign in with Auth0</button>; ssoBrandLogo = Icons.AUTH0_ICON;
ssoBrandName = 'Auth0';
break;
} }
// TODO: Add "case AuthTypes.GITHUB" after adding support for Github SSO // TODO: Add "case AuthTypes.GITHUB" after adding support for Github SSO
default: { default: {
return <></>; break;
} }
} }
return ssoBrandName ? (
<button className="tw-signin-button">
<SVGIcons alt={`${ssoBrandName} Logo`} icon={ssoBrandLogo} width="22" />
<span className="tw-ml-3">Sign in with {ssoBrandName}</span>
</button>
) : (
<></>
);
}; };
if (appState.authDisabled || !isEmpty(appState.userDetails)) { if (appState.authDisabled || !isEmpty(appState.userDetails)) {

View File

@ -1,5 +1,8 @@
import React, { FunctionComponent } from 'react'; import React, { FunctionComponent } from 'react';
import IconGoogle from '../assets/img/google-icon.png'; import IconAuth0 from '../assets/img/icon-auth0.png';
import IconGithub from '../assets/img/icon-github.png';
import IconGoogle from '../assets/img/icon-google.png';
import IconOkta from '../assets/img/icon-okta.png';
import IconWelcomePopper from '../assets/img/welcome-popper-icon.png'; import IconWelcomePopper from '../assets/img/welcome-popper-icon.png';
import IconAPI from '../assets/svg/api.svg'; import IconAPI from '../assets/svg/api.svg';
import IconSuccess from '../assets/svg/check.svg'; import IconSuccess from '../assets/svg/check.svg';
@ -70,6 +73,9 @@ export const Icons = {
LOGO_SMALL: 'logo-small', LOGO_SMALL: 'logo-small',
WELCOME_POPPER: 'welcome-popper', WELCOME_POPPER: 'welcome-popper',
GOOGLE_ICON: 'google-icon', GOOGLE_ICON: 'google-icon',
OKTA_ICON: 'okta-icon',
GITHUB_ICON: 'github-icon',
AUTH0_ICON: 'auth0-icon',
EDIT: 'icon-edit', EDIT: 'icon-edit',
EXPLORE: 'icon-explore', EXPLORE: 'icon-explore',
MY_DATA: 'icon-my-data', MY_DATA: 'icon-my-data',
@ -183,6 +189,18 @@ const SVGIcons: FunctionComponent<Props> = ({
case Icons.GOOGLE_ICON: case Icons.GOOGLE_ICON:
IconComponent = IconGoogle; IconComponent = IconGoogle;
break;
case Icons.OKTA_ICON:
IconComponent = IconOkta;
break;
case Icons.GITHUB_ICON:
IconComponent = IconGithub;
break;
case Icons.AUTH0_ICON:
IconComponent = IconAuth0;
break; break;
case Icons.MENU: case Icons.MENU:
IconComponent = IconMenu; IconComponent = IconMenu;