insomnia/app/ui/components/dropdowns/MethodDropdown.js
Gregory Schier 1d45367aa1 Added eslint and fixed all problems (#101)
* Fixed duplication kve bug

* Added semistandard and updated code

* Actually got it working

* Even better

* I think it should work on Windows now
2017-03-03 12:09:08 -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;