hedgedoc/frontend/src/components/common/custom-branding/use-branding-details.ts
Erik Michelson e411ddf099 refactor(frontend): switch to DTOs from @hedgedoc/commons
Co-authored-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-03-29 22:09:01 +01:00

21 lines
663 B
TypeScript

/*
* SPDX-FileCopyrightText: 2025 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { BrandingDto } from '@hedgedoc/commons'
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 | BrandingDto => {
const branding = useFrontendConfig().branding
return useMemo(() => {
return branding.name === null && branding.logo === null ? null : branding
}, [branding])
}