mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
refactor: replace logo svgs with components
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
3739c59133
commit
3f42798965
10 changed files with 189 additions and 155 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
import LogoBwHorizontal from './logo_text_bw_horizontal.svg'
|
|
||||||
import LogoColorVertical from './logo_text_color_vertical.svg'
|
|
||||||
import LogoWbHorizontal from './logo_text_wb_horizontal.svg'
|
|
||||||
import React from 'react'
|
|
||||||
|
|
||||||
export enum HedgeDocLogoSize {
|
|
||||||
SMALL = 32,
|
|
||||||
MEDIUM = 64,
|
|
||||||
BIG = 256
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HedgeDocLogoProps {
|
|
||||||
size?: HedgeDocLogoSize | number
|
|
||||||
logoType: HedgeDocLogoType
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum HedgeDocLogoType {
|
|
||||||
COLOR_VERTICAL,
|
|
||||||
BW_HORIZONTAL,
|
|
||||||
WB_HORIZONTAL
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders the HedgeDoc logo with the app name in different types.
|
|
||||||
*
|
|
||||||
* @param size The size the logo should have.
|
|
||||||
* @param logoType The logo type to be used.
|
|
||||||
*/
|
|
||||||
export const HedgeDocLogoWithText: React.FC<HedgeDocLogoProps> = ({ size = HedgeDocLogoSize.MEDIUM, logoType }) => {
|
|
||||||
switch (logoType) {
|
|
||||||
case HedgeDocLogoType.COLOR_VERTICAL:
|
|
||||||
return <LogoColorVertical className={'w-auto'} height={`${size}px`} width={'auto'} />
|
|
||||||
case HedgeDocLogoType.BW_HORIZONTAL:
|
|
||||||
return <LogoBwHorizontal className={'w-auto'} height={`${size}px`} width={'auto'} />
|
|
||||||
case HedgeDocLogoType.WB_HORIZONTAL:
|
|
||||||
return <LogoWbHorizontal className={'w-auto'} height={`${size}px`} width={'auto'} />
|
|
||||||
default:
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
11
frontend/src/components/common/hedge-doc-logo/logo-size.tsx
Normal file
11
frontend/src/components/common/hedge-doc-logo/logo-size.tsx
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
export enum LogoSize {
|
||||||
|
SMALL = 32,
|
||||||
|
MEDIUM = 64,
|
||||||
|
BIG = 256
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 9.8 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 9.9 KiB |
|
@ -0,0 +1,9 @@
|
||||||
|
/*!
|
||||||
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
.auto-text {
|
||||||
|
fill: var(--bs-emphasis-color);
|
||||||
|
}
|
|
@ -5,11 +5,8 @@
|
||||||
*/
|
*/
|
||||||
import { useDarkModeState } from '../../../hooks/dark-mode/use-dark-mode-state'
|
import { useDarkModeState } from '../../../hooks/dark-mode/use-dark-mode-state'
|
||||||
import { CustomBranding } from '../../common/custom-branding/custom-branding'
|
import { CustomBranding } from '../../common/custom-branding/custom-branding'
|
||||||
import {
|
import { HedgeDocLogoHorizontalGrey } from '../../common/hedge-doc-logo/hedge-doc-logo-horizontal-grey'
|
||||||
HedgeDocLogoSize,
|
import { LogoSize } from '../../common/hedge-doc-logo/logo-size'
|
||||||
HedgeDocLogoType,
|
|
||||||
HedgeDocLogoWithText
|
|
||||||
} from '../../common/hedge-doc-logo/hedge-doc-logo-with-text'
|
|
||||||
import { BrandingSeparatorDash } from './branding-separator-dash'
|
import { BrandingSeparatorDash } from './branding-separator-dash'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
@ -24,10 +21,7 @@ export const NavbarBranding: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<Navbar.Brand>
|
<Navbar.Brand>
|
||||||
<Link href='/intro' className='text-secondary text-decoration-none d-flex align-items-center'>
|
<Link href='/intro' className='text-secondary text-decoration-none d-flex align-items-center'>
|
||||||
<HedgeDocLogoWithText
|
<HedgeDocLogoHorizontalGrey size={LogoSize.SMALL} color={darkModeActivated ? 'dark' : 'light'} />
|
||||||
logoType={darkModeActivated ? HedgeDocLogoType.WB_HORIZONTAL : HedgeDocLogoType.BW_HORIZONTAL}
|
|
||||||
size={HedgeDocLogoSize.SMALL}
|
|
||||||
/>
|
|
||||||
<BrandingSeparatorDash />
|
<BrandingSeparatorDash />
|
||||||
<CustomBranding inline={true} />
|
<CustomBranding inline={true} />
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -4,11 +4,8 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
import { CustomBranding } from '../components/common/custom-branding/custom-branding'
|
import { CustomBranding } from '../components/common/custom-branding/custom-branding'
|
||||||
import {
|
import { HedgeDocLogoVertical } from '../components/common/hedge-doc-logo/hedge-doc-logo-vertical'
|
||||||
HedgeDocLogoSize,
|
import { LogoSize } from '../components/common/hedge-doc-logo/logo-size'
|
||||||
HedgeDocLogoType,
|
|
||||||
HedgeDocLogoWithText
|
|
||||||
} from '../components/common/hedge-doc-logo/hedge-doc-logo-with-text'
|
|
||||||
import { EditorToRendererCommunicatorContextProvider } from '../components/editor-page/render-context/editor-to-renderer-communicator-context-provider'
|
import { EditorToRendererCommunicatorContextProvider } from '../components/editor-page/render-context/editor-to-renderer-communicator-context-provider'
|
||||||
import { CoverButtons } from '../components/intro-page/cover-buttons/cover-buttons'
|
import { CoverButtons } from '../components/intro-page/cover-buttons/cover-buttons'
|
||||||
import { IntroCustomContent } from '../components/intro-page/intro-custom-content'
|
import { IntroCustomContent } from '../components/intro-page/intro-custom-content'
|
||||||
|
@ -26,7 +23,7 @@ const IntroPage: NextPage = () => {
|
||||||
<EditorToRendererCommunicatorContextProvider>
|
<EditorToRendererCommunicatorContextProvider>
|
||||||
<div className={'flex-fill mt-3'}>
|
<div className={'flex-fill mt-3'}>
|
||||||
<h1 dir='auto' className={'align-items-center d-flex justify-content-center flex-column'}>
|
<h1 dir='auto' className={'align-items-center d-flex justify-content-center flex-column'}>
|
||||||
<HedgeDocLogoWithText logoType={HedgeDocLogoType.COLOR_VERTICAL} size={HedgeDocLogoSize.BIG} />
|
<HedgeDocLogoVertical size={LogoSize.BIG} autoTextColor={true} />
|
||||||
</h1>
|
</h1>
|
||||||
<p className='lead'>
|
<p className='lead'>
|
||||||
<Trans i18nKey='app.slogan' />
|
<Trans i18nKey='app.slogan' />
|
||||||
|
|
Loading…
Reference in a new issue