mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 07:58:16 -05:00
8bc374c916
[web] BS5 review panel new GitOrigin-RevId: c65d17d0053858bd74984ba746a620b89d900606
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { FC, memo } from 'react'
|
|
import { Trans } from 'react-i18next'
|
|
import { useEditorManagerContext } from '@/features/ide-react/context/editor-manager-context'
|
|
import Icon from '@/shared/components/icon'
|
|
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
|
|
const ReviewPanelTrackChangesMenuButton: FC<{
|
|
menuExpanded: boolean
|
|
setMenuExpanded: React.Dispatch<React.SetStateAction<boolean>>
|
|
}> = ({ menuExpanded, setMenuExpanded }) => {
|
|
const { wantTrackChanges } = useEditorManagerContext()
|
|
|
|
return (
|
|
<button
|
|
className="track-changes-menu-button"
|
|
onClick={() => setMenuExpanded(value => !value)}
|
|
>
|
|
{wantTrackChanges && <div className="track-changes-indicator-circle" />}
|
|
{wantTrackChanges ? (
|
|
<Trans
|
|
i18nKey="track_changes_is_on"
|
|
components={{ strong: <strong /> }}
|
|
/>
|
|
) : (
|
|
<Trans
|
|
i18nKey="track_changes_is_off"
|
|
components={{ strong: <strong /> }}
|
|
/>
|
|
)}
|
|
<BootstrapVersionSwitcher
|
|
bs3={<Icon type={menuExpanded ? 'angle-down' : 'angle-right'} />}
|
|
bs5={
|
|
<MaterialIcon type={menuExpanded ? 'expand_more' : 'chevron_right'} />
|
|
}
|
|
/>
|
|
</button>
|
|
)
|
|
}
|
|
|
|
export default memo(ReviewPanelTrackChangesMenuButton)
|