Files
insomnia/app/ui/components/dropdowns/MethodDropdown.js
T
Gregory Schier b198e6170b React performance sweep (#96)
* Removed some unnecessary rendering

* Only PureComponents and some other stuff

* Removed all functional components

* Only deal with nunjucks marks

* Remove ref assign functions in modals

* Lots of tweaks

* A bit snappier

* A bit snappier
2017-02-28 13:32:23 -08:00

32 lines
975 B
JavaScript

import React, {PropTypes, PureComponent} from 'react';
import {Dropdown, DropdownButton, DropdownItem} from '../base/dropdown';
import * as constants from '../../../common/constants';
class MethodDropdown extends PureComponent {
render () {
const {method, onChange, right, ...extraProps} = this.props;
return (
<Dropdown className="method-dropdown" right={right}>
<DropdownButton type="button" {...extraProps}>
{method} <i className="fa fa-caret-down"/>
</DropdownButton>
{constants.HTTP_METHODS.map(method => (
<DropdownItem key={method}
className={`http-method-${method}`}
onClick={onChange}
value={method}>
{method}
</DropdownItem>
))}
</Dropdown>
)
}
}
MethodDropdown.propTypes = {
onChange: PropTypes.func.isRequired,
method: PropTypes.string.isRequired,
};
export default MethodDropdown;