From 939aebda1c98f92cce988d58fe50077ba97b4df8 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Sun, 20 Mar 2016 23:36:39 -0700 Subject: [PATCH] Better --- app/components/Dropdown.js | 14 ++++++++++---- app/components/RequestPane.js | 9 +++++---- app/components/Sidebar.js | 19 +++++++++++++++---- app/css/components/dropdown.scss | 8 +++++++- 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/app/components/Dropdown.js b/app/components/Dropdown.js index 5e4d2e761..37f2511cb 100644 --- a/app/components/Dropdown.js +++ b/app/components/Dropdown.js @@ -5,15 +5,16 @@ class Dropdown extends Component { super(); this.state = {open: false}; } - + componentDidMount () { // Capture clicks outside the component and close the dropdown + // TODO: Remove this listener when component unmounts document.addEventListener('click', (e) => { if (!this.refs.container.contains(e.target)) { e.preventDefault(); this.setState({open: false}); } - }) + }); } handleClick (e) { @@ -25,7 +26,10 @@ class Dropdown extends Component { const {initialValue, value} = this.props; return (
{this.props.children}
@@ -33,6 +37,8 @@ class Dropdown extends Component { } } -Dropdown.propTypes = {}; +Dropdown.propTypes = { + right: PropTypes.bool +}; export default Dropdown; diff --git a/app/components/RequestPane.js b/app/components/RequestPane.js index 0c44e8e1d..cd1fb1623 100644 --- a/app/components/RequestPane.js +++ b/app/components/RequestPane.js @@ -1,6 +1,7 @@ import React, {Component, PropTypes} from 'react' import CodeEditor from '../components/CodeEditor' import UrlInput from '../components/UrlInput' +import {METHOD_GET} from '../constants/global' import {Tab, Tabs, TabList, TabPanel} from 'react-tabs'; // Don't inject component styles (use our own) @@ -28,13 +29,13 @@ class RequestPane extends Component { urlValue={request.url}/>
- + - + - + @@ -43,13 +44,13 @@ class RequestPane extends Component { - Params + Params Basic Auth Headers diff --git a/app/components/Sidebar.js b/app/components/Sidebar.js index b4553c1c2..36a482b23 100644 --- a/app/components/Sidebar.js +++ b/app/components/Sidebar.js @@ -1,13 +1,24 @@ import React, {PropTypes} from 'react' +import Dropdown from '../components/Dropdown' const Sidebar = (props) => (