fix: use html entity for branding separation dash

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-05-10 16:31:03 +02:00
parent 3feaa8d6a5
commit 40e9478c67
5 changed files with 43 additions and 20 deletions

View file

@ -3,8 +3,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useFrontendConfig } from '../frontend-config-context/use-frontend-config'
import styles from './branding.module.scss'
import { useBrandingDetails } from './use-branding-details'
import React from 'react'
export interface BrandingProps {
@ -19,9 +19,9 @@ export interface BrandingProps {
* @param delimiter If the delimiter between the HedgeDoc logo and the branding should be shown.
*/
export const CustomBranding: React.FC<BrandingProps> = ({ inline = false }) => {
const branding = useFrontendConfig().branding
const branding = useBrandingDetails()
if (!branding.name && !branding.logo) {
if (!branding) {
return null
} else if (branding.logo) {
return (

View file

@ -0,0 +1,21 @@
/*
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { BrandingConfig } from '../../../api/config/types'
import { useFrontendConfig } from '../frontend-config-context/use-frontend-config'
import { useMemo } from 'react'
/**
* Extracts the branding from the config.
*
* @return the branding configuration or null if no branding has been configured
*/
export const useBrandingDetails = (): null | BrandingConfig => {
const branding = useFrontendConfig().branding
return useMemo(() => {
return !branding.name && !branding.logo ? null : branding
}, [branding])
}