import React, {PureComponent, PropTypes} from 'react'; import {Dropdown, DropdownDivider, DropdownButton, DropdownItem} from '../base/dropdown'; import {PREVIEW_MODES, getPreviewModeName} from '../../../common/constants'; import {trackEvent} from '../../../analytics/index'; class PreviewModeDropdown extends PureComponent { _handleClick = previewMode => { this.props.updatePreviewMode(previewMode); trackEvent('Response', 'Preview Mode Change', mode); }; render () { const {download, previewMode} = this.props; return ( {PREVIEW_MODES.map(mode => ( {previewMode === mode ? : } {getPreviewModeName(mode)} ))} Save to File ) } } PreviewModeDropdown.propTypes = { // Functions updatePreviewMode: PropTypes.func.isRequired, download: PropTypes.func.isRequired, // Required previewMode: PropTypes.string.isRequired }; export default PreviewModeDropdown;