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