mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 22:35:50 -04:00
Code improvements (#1086)
* Extract code into hook * Refactor code to remove let * Reformat code * Extract version-info-modal into components * Use main block in landinglayout * Add fixedWidth and classname attribute to IconButton Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
029295dd3b
commit
107f0f6fa3
14 changed files with 192 additions and 142 deletions
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { Fragment, useCallback, useState } from 'react'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { VersionInfoModal } from './version-info-modal'
|
||||
|
||||
export const VersionInfoLink: React.FC = () => {
|
||||
const [show, setShow] = useState(false)
|
||||
const closeModal = useCallback(() => setShow(false), [])
|
||||
const showModal = useCallback(() => setShow(true), [])
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<Link data-cy={ 'show-version-modal' } to={ '#' } className={ 'text-light' } onClick={ showModal }>
|
||||
<Trans i18nKey={ 'landing.versionInfo.versionInfo' }/>
|
||||
</Link>
|
||||
<VersionInfoModal onHide={ closeModal } show={ show }/>
|
||||
</Fragment>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue