mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-03 20:09:55 -05:00
35 lines
1 KiB
TypeScript
35 lines
1 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'
|
||
|
|
||
|
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 /> }}
|
||
|
/>
|
||
|
)}
|
||
|
<Icon type={menuExpanded ? 'angle-down' : 'angle-right'} />
|
||
|
</button>
|
||
|
)
|
||
|
}
|
||
|
|
||
|
export default memo(ReviewPanelTrackChangesMenuButton)
|