overleaf/services/web/frontend/js/features/editor-navigation-toolbar/components/track-changes-toggle-button.js
Alf Eaton 08ccdb79d3 [cm6] Improve alignment of review panel elements (#12710)
* Use a block widget for top padding
* Update review panel positions when the editor geometry changes
* Remove editorPaddingTop from position calculations
* Recalculate review panel on start adding comment
* Assert on line content rather than index
* Use broadcastChange
* Keep focus in the editor when opening the review panel
* debounce broadcastChange
* Set CULL_AFTER to Infinity

GitOrigin-RevId: a8d7b8967736a9164b5264eeaadf334c15ec95ce
2023-04-25 08:05:02 +00:00

28 lines
789 B
JavaScript

import PropTypes from 'prop-types'
import classNames from 'classnames'
import { useTranslation } from 'react-i18next'
function TrackChangesToggleButton({ trackChangesIsOpen, disabled, onClick }) {
const { t } = useTranslation()
const classes = classNames('btn', 'btn-full-height', {
active: trackChangesIsOpen && !disabled,
disabled,
})
return (
<div className="toolbar-item">
<button disabled={disabled} className={classes} onMouseDown={onClick}>
<i className="review-icon" />
<p className="toolbar-label">{t('review')}</p>
</button>
</div>
)
}
TrackChangesToggleButton.propTypes = {
trackChangesIsOpen: PropTypes.bool,
disabled: PropTypes.bool,
onClick: PropTypes.func.isRequired,
}
export default TrackChangesToggleButton