hedgedoc/src/components/common/branding/branding.tsx
Tilman Vatteroth bee715b8f9 Remove log message and fix null check
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
2020-07-02 23:17:16 +02:00

30 lines
880 B
TypeScript

import React from 'react'
import { useSelector } from 'react-redux'
import { ApplicationState } from '../../../redux'
import { ShowIf } from '../show-if/show-if'
import './branding.scss'
export interface BrandingProps {
inline?: boolean
}
export const Branding: React.FC<BrandingProps> = ({ inline = false }) => {
const branding = useSelector((state: ApplicationState) => state.backendConfig.branding)
const showBranding = !!branding.name || !!branding.logo
return (
<ShowIf condition={showBranding}>
<strong className={`mx-1 ${inline ? 'inline-size' : 'regular-size'}`} >@</strong>
{
branding.logo
? <img
src={branding.logo}
alt={branding.name}
title={branding.name}
className={inline ? 'inline-size' : 'regular-size'}
/>
: branding.name
}
</ShowIf>
)
}