overleaf/services/web/frontend/js/features/pdf-preview/components/switch-to-editor-button.tsx
Davinder Singh d6b39c4bb3 Merge pull request #10653 from overleaf/ds-btn-default-to-secondary-in-editor
Replacing `btn-default` with `btn-secondary` in the editor

GitOrigin-RevId: 46aa8c92c9981eb2f253828ee65424bfb7217fb2
2022-12-08 09:03:35 +00:00

36 lines
779 B
TypeScript

import { useTranslation } from 'react-i18next'
import { Button } from 'react-bootstrap'
import Icon from '../../../shared/components/icon'
import { useLayoutContext } from '../../../shared/context/layout-context'
function SwitchToEditorButton() {
const { pdfLayout, setView, detachRole } = useLayoutContext()
const { t } = useTranslation()
if (detachRole) {
return null
}
if (pdfLayout === 'sideBySide') {
return null
}
function handleClick() {
setView('editor')
}
return (
<Button
bsStyle={null}
bsSize="xs"
onClick={handleClick}
className="switch-to-editor-btn btn-secondary"
>
<Icon type="code" className="me-1" />
{t('switch_to_editor')}
</Button>
)
}
export default SwitchToEditorButton