import PropTypes from 'prop-types'
import { Dropdown, MenuItem } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'
import Icon from '../../../shared/components/icon'
import IconChecked from '../../../shared/components/icon-checked'
import ControlledDropdown from '../../../shared/components/controlled-dropdown'
import IconEditorOnly from './icon-editor-only'
import IconPdfOnly from './icon-pdf-only'
function IconCheckmark({ iconFor, pdfLayout, view }) {
if (iconFor === 'editorOnly' && pdfLayout === 'flat' && view === 'editor') {
return
} else if (iconFor === 'pdfOnly' && pdfLayout === 'flat' && view === 'pdf') {
return
} else if (iconFor === 'sideBySide' && pdfLayout === 'sideBySide') {
return
}
// return empty icon for placeholder
return
}
function LayoutDropdownButton({
reattach,
detach,
handleChangeLayout,
detachMode,
detachRole,
pdfLayout,
view,
}) {
const { t } = useTranslation()
// bsStyle is required for Dropdown.Toggle, but we will override style
return (
<>
{detachMode === 'detaching' && (
{t('layout_processing')}
)}
{detachMode === 'detaching' ? (
) : (
)}
{t('layout')}
{detachRole === 'detacher' ? (
) : (
)}
>
)
}
export default LayoutDropdownButton
IconCheckmark.propTypes = {
iconFor: PropTypes.string.isRequired,
pdfLayout: PropTypes.string.isRequired,
view: PropTypes.string,
}
LayoutDropdownButton.propTypes = {
reattach: PropTypes.func.isRequired,
detach: PropTypes.func.isRequired,
handleChangeLayout: PropTypes.func.isRequired,
detachMode: PropTypes.string,
detachRole: PropTypes.string,
pdfLayout: PropTypes.string.isRequired,
view: PropTypes.string,
}