All files / modules/10-common/components/AuthLayout/AuthFooter AuthFooter.tsx

100% Statements 15/15
100% Branches 6/6
100% Functions 3/3
100% Lines 15/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73              2x 2x   2x   2x 2x   2x 2x 2x             2x 3x 3x                     18x   18x   18x                                                           2x  
/*
 * Copyright 2021 Harness Inc. All rights reserved.
 * Use of this source code is governed by the PolyForm Shield 1.0.0 license
 * that can be found in the licenses directory at the root of this repository, also available at
 * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt.
 */
 
import React from 'react'
import { Icon, Text, Container } from '@wings-software/uicore'
 
import { OAuthProviderType, OAuthProviders, URLS } from '@common/constants/OAuthProviders'
 
import { useStrings } from 'framework/strings'
import css from './AuthFooter.module.scss'
 
export enum AuthPage {
  SignIn,
  SignUp
}
 
interface AuthFooterProps {
  page: AuthPage
}
 
const AuthFooter: React.FC<AuthFooterProps> = ({ page }) => {
  const { getString } = useStrings()
  return (
    <>
      <h2 className={css.lineMessage}>
        <span className={css.message}>
          {page === AuthPage.SignUp ? getString('signUp.oAuth.signup') : getString('signUp.oAuth.signin')}
        </span>
      </h2>
 
      <Container padding="large">
        <div className={css.oAuthIcons}>
          {OAuthProviders.map((oAuthProvider: OAuthProviderType) => {
            const { iconName, type, url } = oAuthProvider
 
            const link = `${URLS.OAUTH}api/users/${url}`
 
            return (
              <a className={css.iconContainer} key={type} href={link} rel="noreferrer" target="_blank">
                <Icon name={iconName} size={24} />
              </a>
            )
          })}
        </div>
        {page === AuthPage.SignUp ? (
          <div className={css.disclaimer}>
            {getString('signUp.disclaimer.initial')}
            <a className={css.externalLink} href={URLS.PRIVACY_AGREEMENT} rel="noreferrer" target="_blank">
              {getString('signUp.disclaimer.privacyPolicy')}
            </a>
            {getString('signUp.disclaimer.middle')}
            <a className={css.externalLink} href={URLS.SUBSCRIPTION_TERMS} rel="noreferrer" target="_blank">
              {getString('signUp.disclaimer.terms')}
            </a>
          </div>
        ) : (
          <button className={css.ssoButton}>
            <Text icon="cloud-sso" iconProps={{ className: css.icon, size: 24 }} className={css.text}>
              {getString('signUp.ssoButton')}
            </Text>
          </button>
        )}
      </Container>
    </>
  )
}
 
export default AuthFooter