fix: deduplicate different buttons

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-03-08 20:21:19 +01:00
parent 160f0f8297
commit aa6bd2a884
12 changed files with 44 additions and 194 deletions

View file

@ -5,13 +5,13 @@
*/
import { useApplicationState } from '../../../hooks/common/use-application-state'
import { NoteType } from '../../../redux/note-details/types/note-details'
import { NewNoteButton } from '../../common/new-note-button/new-note-button'
import { ShowIf } from '../../common/show-if/show-if'
import { SignInButton } from '../../landing-layout/navigation/sign-in-button'
import { UserDropdown } from '../../landing-layout/navigation/user-dropdown'
import { SettingsButton } from '../../layout/settings-dialog/settings-button'
import { HelpButton } from './help-button/help-button'
import { NavbarBranding } from './navbar-branding'
import { NewNoteButton } from './new-note-button'
import { ReadOnlyModeButton } from './read-only-mode-button'
import { SlideModeButton } from './slide-mode-button'
import React from 'react'
@ -49,8 +49,8 @@ export const AppBar: React.FC<AppBarProps> = ({ mode }) => {
<HelpButton />
</ShowIf>
</Nav>
<Nav className='d-flex align-items-center text-secondary justify-content-end'>
<SettingsButton className={'p-1 mx-2'} variant={'outline-dark'} />
<Nav className='d-flex gap-2 align-items-center text-secondary justify-content-end'>
<SettingsButton variant={'outline-dark'} />
<NewNoteButton />
<ShowIf condition={!userExists}>
<SignInButton size={'sm'} />

View file

@ -1,25 +0,0 @@
/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { IconButton } from '../../common/icon-button/icon-button'
import Link from 'next/link'
import React from 'react'
import { Plus as IconPlus } from 'react-bootstrap-icons'
import { Trans, useTranslation } from 'react-i18next'
/**
* Renders a button to create a new note.
*/
export const NewNoteButton: React.FC = () => {
useTranslation()
return (
<Link href={'/new'} passHref={true}>
<IconButton className='mx-2' iconSize={1.5} icon={IconPlus}>
<Trans i18nKey='editor.appBar.new' />
</IconButton>
</Link>
)
}