mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
6a136bd76a
* Add multi-part form support * tests for form and multipart * Better Analytics Tracking
36 lines
1.1 KiB
JavaScript
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;
|