mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-22 11:15:23 -04:00

These icon replace fork awesome. A linter informs the user about the deprecation. See https://github.com/hedgedoc/hedgedoc/issues/2929 Co-authored-by: Philip Molares <philip.molares@udo.edu> Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de> Signed-off-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
import { useBooleanState } from '../../../../hooks/common/use-boolean-state'
|
|
import { ShareModal } from '../../document-bar/share/share-modal'
|
|
import { SidebarButton } from '../sidebar-button/sidebar-button'
|
|
import type { SpecificSidebarEntryProps } from '../types'
|
|
import React, { Fragment } from 'react'
|
|
import { Share as IconShare } from 'react-bootstrap-icons'
|
|
import { Trans, useTranslation } from 'react-i18next'
|
|
|
|
/**
|
|
* Renders a button to open the share modal for the sidebar.
|
|
*
|
|
* @param className Additional classes directly given to the button
|
|
* @param hide If the button should be hidden
|
|
*/
|
|
export const ShareSidebarEntry: React.FC<SpecificSidebarEntryProps> = ({ className, hide }) => {
|
|
const [modalVisibility, showModal, closeModal] = useBooleanState()
|
|
useTranslation()
|
|
|
|
return (
|
|
<Fragment>
|
|
<SidebarButton hide={hide} className={className} icon={IconShare} onClick={showModal}>
|
|
<Trans i18nKey={'editor.modal.shareLink.title'} />
|
|
</SidebarButton>
|
|
<ShareModal show={modalVisibility} onHide={closeModal} />
|
|
</Fragment>
|
|
)
|
|
}
|