insomnia/app/ui/components/dropdowns/PreviewModeDropdown.js
Gregory Schier 6a136bd76a Add multi-part form support (#49)
* Add multi-part form support

* tests for form and multipart

* Better Analytics Tracking
2016-11-23 11:33:24 -08:00

36 lines
1.1 KiB
JavaScript

import React, {PropTypes} from 'react';
import {Dropdown, DropdownDivider, DropdownButton, DropdownItem} from '../base/dropdown';
import {PREVIEW_MODES, getPreviewModeName} from '../../../common/constants';
import {trackEvent} from '../../../analytics/index';
const PreviewModeDropdown = ({updatePreviewMode, download}) => (
<Dropdown>
<DropdownButton className="tall">
<i className="fa fa-caret-down"></i>
</DropdownButton>
{PREVIEW_MODES.map(previewMode => (
<DropdownItem key={previewMode} onClick={() => {
updatePreviewMode(previewMode);
trackEvent('Response', 'Preview Mode Change', previewMode);
}}>
{getPreviewModeName(previewMode)}
</DropdownItem>
))}
<DropdownDivider></DropdownDivider>
<DropdownItem onClick={download}>
Download
</DropdownItem>
</Dropdown>
);
PreviewModeDropdown.propTypes = {
// Functions
updatePreviewMode: PropTypes.func.isRequired,
download: PropTypes.func.isRequired,
// Required
previewMode: PropTypes.string.isRequired
};
export default PreviewModeDropdown;