insomnia/app/ui/components/dropdowns/MethodDropdown.js
Gregory Schier 6c1c03cef6 Various Improvements (#59)
* Better create, started response history

* Response history working

* A bunch
2016-11-27 13:42:38 -08:00

32 lines
967 B
JavaScript

import React, {PropTypes, Component} from 'react';
import {Dropdown, DropdownButton, DropdownItem} from '../base/dropdown';
import * as constants from '../../../common/constants';
class MethodDropdown extends Component {
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;