hedgedoc/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/share-sidebar-entry.tsx
Philip Molares 1c16e25e14 feat(frontend): replace forkawesome with bootstrap icons
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>
2023-02-24 14:31:17 +01:00

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>
)
}