Show login-buttons and boxes only if providers are configured (#122)

* Hide "Sign-in via ..." box if no provider is enabled

* Show sign-in buttons only if auth-providers exist

* Rebase fixes

* Replaced ternary operators with ShowIf

* Added ShowIf on two other code positions
This commit is contained in:
Erik Michelson 2020-06-04 23:38:21 +02:00 committed by GitHub
parent 2b4c3c76ba
commit b051b109e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 47 deletions

View file

@ -4,12 +4,14 @@ import { Trans, useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { Link } from 'react-router-dom'
import { ApplicationState } from '../../../../../redux'
import { ShowIf } from '../../../../common/show-if'
import { SignInButton } from '../../../layout/navigation/sign-in-button'
import './cover-buttons.scss'
export const CoverButtons: React.FC = () => {
useTranslation()
const user = useSelector((state: ApplicationState) => state.user)
const authProviders = useSelector((state: ApplicationState) => state.backendConfig.authProviders)
if (user) {
return null
@ -22,11 +24,11 @@ export const CoverButtons: React.FC = () => {
variant="success"
size="lg"
/>
<span className="m-2">
<Trans i18nKey="common.or"/>
</span>
<ShowIf condition={Object.values(authProviders).includes(true)}>
<span className="m-2">
<Trans i18nKey="common.or"/>
</span>
</ShowIf>
<Link to="/features">
<Button
className="cover-button"