mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
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:
parent
2b4c3c76ba
commit
b051b109e5
3 changed files with 58 additions and 47 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue