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({ handleChangeLayout, pdfLayout, view }) { const { t } = useTranslation() // bsStyle is required for Dropdown.Toggle, but we will override style return ( {t('layout')} {t('layout')} handleChangeLayout('sideBySide')}> {t('editor_and_pdf')} handleChangeLayout('flat', 'editor')} className="menu-item-with-svg" > , ]} /> handleChangeLayout('flat', 'pdf')} className="menu-item-with-svg" > , ]} /> ) } export default LayoutDropdownButton IconCheckmark.propTypes = { iconFor: PropTypes.string.isRequired, pdfLayout: PropTypes.string.isRequired, view: PropTypes.string, } LayoutDropdownButton.propTypes = { handleChangeLayout: PropTypes.func.isRequired, pdfLayout: PropTypes.string.isRequired, view: PropTypes.string, }