mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 23:24:46 -04:00
added branding option (#301)
added branding option via '@ <logo>' or '@ <name>' after the CodiMD logo and text. This was a user can personalize their CodiMD instance Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Co-authored-by: Erik Michelson <github@erik.michelson.eu> Co-authored-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
50b04c8403
commit
b23a73ac51
11 changed files with 79 additions and 4 deletions
|
@ -30,6 +30,7 @@
|
||||||
- Users may now change their display name and password (only email accounts) on the new profile page
|
- Users may now change their display name and password (only email accounts) on the new profile page
|
||||||
- Highlighted code blocks can now use line wrapping and line numbers at once
|
- Highlighted code blocks can now use line wrapping and line numbers at once
|
||||||
- Images, videos, and other non-text content is now wider in View Mode
|
- Images, videos, and other non-text content is now wider in View Mode
|
||||||
|
- CodiMD instances can now be branded either with a '@ <custom string>' or '@ <custom logo>' after the CodiMD logo and text
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
BIN
public/acme.png
Normal file
BIN
public/acme.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
|
@ -13,6 +13,10 @@
|
||||||
"email": true,
|
"email": true,
|
||||||
"openid": true
|
"openid": true
|
||||||
},
|
},
|
||||||
|
"branding": {
|
||||||
|
"name": "ACME Corp",
|
||||||
|
"logo": "http://localhost:3000/acme.png"
|
||||||
|
},
|
||||||
"banner": {
|
"banner": {
|
||||||
"text": "This is the test banner text",
|
"text": "This is the test banner text",
|
||||||
"timestamp": "2020-05-22T20:46:08.962Z"
|
"timestamp": "2020-05-22T20:46:08.962Z"
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
export interface BackendConfig {
|
export interface BackendConfig {
|
||||||
allowAnonymous: boolean,
|
allowAnonymous: boolean,
|
||||||
authProviders: AuthProvidersState,
|
authProviders: AuthProvidersState,
|
||||||
|
branding: BrandingConfig,
|
||||||
banner: BannerConfig,
|
banner: BannerConfig,
|
||||||
customAuthNames: CustomAuthNames,
|
customAuthNames: CustomAuthNames,
|
||||||
specialLinks: SpecialLinks,
|
specialLinks: SpecialLinks,
|
||||||
version: BackendVersion,
|
version: BackendVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface BrandingConfig {
|
||||||
|
name: string,
|
||||||
|
logo: string,
|
||||||
|
}
|
||||||
|
|
||||||
export interface BannerConfig {
|
export interface BannerConfig {
|
||||||
text: string
|
text: string
|
||||||
timestamp: string
|
timestamp: string
|
||||||
|
|
7
src/components/common/branding/branding.scss
Normal file
7
src/components/common/branding/branding.scss
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
.regular-size {
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-size {
|
||||||
|
height: 30px;
|
||||||
|
}
|
32
src/components/common/branding/branding.tsx
Normal file
32
src/components/common/branding/branding.tsx
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
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 !== ''
|
||||||
|
|
||||||
|
console.log(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>
|
||||||
|
)
|
||||||
|
}
|
13
src/components/common/document-title/document-title.tsx
Normal file
13
src/components/common/document-title/document-title.tsx
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import React, { useEffect } from 'react'
|
||||||
|
import { useSelector } from 'react-redux'
|
||||||
|
import { ApplicationState } from '../../../redux'
|
||||||
|
|
||||||
|
export const DocumentTitle: React.FC = () => {
|
||||||
|
const branding = useSelector((state: ApplicationState) => state.backendConfig.branding)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = `CodiMD ${branding.name ? ` @ ${branding.name}` : ''}`
|
||||||
|
}, [branding])
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ import React from 'react'
|
||||||
import { Button, Nav, Navbar } from 'react-bootstrap'
|
import { Button, Nav, Navbar } from 'react-bootstrap'
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
import { Branding } from '../../common/branding/branding'
|
||||||
import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
||||||
import { ConnectionIndicator } from './connection-indicator'
|
import { ConnectionIndicator } from './connection-indicator'
|
||||||
import { DarkModeButton } from './dark-mode-button'
|
import { DarkModeButton } from './dark-mode-button'
|
||||||
|
@ -15,8 +16,10 @@ const TaskBar: React.FC = () => {
|
||||||
<Navbar bg={'light'}>
|
<Navbar bg={'light'}>
|
||||||
<Nav className="mr-auto d-flex align-items-center">
|
<Nav className="mr-auto d-flex align-items-center">
|
||||||
<Navbar.Brand>
|
<Navbar.Brand>
|
||||||
<Link to="/intro" className="text-secondary">
|
<Link to="/intro" className="text-secondary text-decoration-none d-flex align-items-center">
|
||||||
<ForkAwesomeIcon icon="file-text"/> CodiMD
|
<ForkAwesomeIcon icon="file-text" className={'mr-2'}/>
|
||||||
|
<span>CodiMD</span>
|
||||||
|
<Branding inline={true}/>
|
||||||
</Link>
|
</Link>
|
||||||
</Navbar.Brand>
|
</Navbar.Brand>
|
||||||
<EditorViewMode/>
|
<EditorViewMode/>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Container } from 'react-bootstrap'
|
import { Container } from 'react-bootstrap'
|
||||||
|
import { DocumentTitle } from '../common/document-title/document-title'
|
||||||
import { Footer } from './layout/footer/footer'
|
import { Footer } from './layout/footer/footer'
|
||||||
import { InfoBanner } from './layout/info-banner'
|
import { InfoBanner } from './layout/info-banner'
|
||||||
import { HeaderBar } from './layout/navigation/header-bar/header-bar'
|
import { HeaderBar } from './layout/navigation/header-bar/header-bar'
|
||||||
|
@ -7,6 +8,7 @@ import { HeaderBar } from './layout/navigation/header-bar/header-bar'
|
||||||
export const LandingLayout: React.FC = ({ children }) => {
|
export const LandingLayout: React.FC = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<Container className="text-white d-flex flex-column mvh-100">
|
<Container className="text-white d-flex flex-column mvh-100">
|
||||||
|
<DocumentTitle/>
|
||||||
<InfoBanner/>
|
<InfoBanner/>
|
||||||
<HeaderBar/>
|
<HeaderBar/>
|
||||||
<div className={'d-flex flex-column justify-content-between flex-fill text-center'}>
|
<div className={'d-flex flex-column justify-content-between flex-fill text-center'}>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
|
import { Branding } from '../../../common/branding/branding'
|
||||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||||
import { CoverButtons } from './cover-buttons/cover-buttons'
|
import { CoverButtons } from './cover-buttons/cover-buttons'
|
||||||
import { FeatureLinks } from './feature-links'
|
import { FeatureLinks } from './feature-links'
|
||||||
|
@ -10,8 +11,10 @@ const Intro: React.FC = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<h1 dir='auto'>
|
<h1 dir='auto' className={'align-items-center d-flex justify-content-center'}>
|
||||||
<ForkAwesomeIcon icon="file-text"/> CodiMD
|
<ForkAwesomeIcon icon="file-text" className={'mr-2'}/>
|
||||||
|
<span>CodiMD</span>
|
||||||
|
<Branding/>
|
||||||
</h1>
|
</h1>
|
||||||
<p className="lead mb-5">
|
<p className="lead mb-5">
|
||||||
<Trans i18nKey="app.slogan"/>
|
<Trans i18nKey="app.slogan"/>
|
||||||
|
|
|
@ -17,6 +17,10 @@ export const initialState: BackendConfig = {
|
||||||
email: false,
|
email: false,
|
||||||
openid: false
|
openid: false
|
||||||
},
|
},
|
||||||
|
branding: {
|
||||||
|
name: '',
|
||||||
|
logo: ''
|
||||||
|
},
|
||||||
banner: {
|
banner: {
|
||||||
text: '',
|
text: '',
|
||||||
timestamp: ''
|
timestamp: ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue