import React from 'react'; import { Trans, useTranslation } from 'react-i18next'; import { randomQuote } from '../../utils/get-words'; import Login from '../Header/components/Login'; import { Link, Spacer, Loader } from '../helpers'; import IntroDescription from './components/IntroDescription'; import './intro.css'; interface IntroProps { complete?: boolean; completedChallengeCount?: number; isSignedIn?: boolean; name?: string; pending?: boolean; slug?: string; username?: string; } const Intro = ({ isSignedIn, name, pending, complete, completedChallengeCount, slug }: IntroProps): JSX.Element => { const { t } = useTranslation(); if (pending && !complete) { return ( <> ); } else if (isSignedIn) { const { quote, author } = randomQuote(); return ( <>

{name ? `${t('learn.welcome-1', { name: name })}` : `${t('learn.welcome-2')}`}

{quote}
{author}
{completedChallengeCount && slug && completedChallengeCount < 15 ? (

) : ( '' )} ); } else { return ( <>

{t('learn.heading')}

{t('buttons.logged-out-cta-btn')} ); } }; Intro.displayName = 'Intro'; export default Intro;