insomnia/app/components/Sidebar.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-03-20 04:00:40 +00:00
import React, {PropTypes} from 'react'
2016-03-18 00:36:00 +00:00
const Sidebar = (props) => (
2016-03-18 21:31:45 +00:00
<aside id="sidebar" className="pane">
2016-03-20 04:00:40 +00:00
<header className="pane__header bg-primary">
<h2>
<a href="#" className="pane__header__content">
{props.loading ? <i className="fa fa-refresh fa-spin pull-right"></i> : ''}
Insomnia
</a>
</h2>
2016-03-18 00:36:00 +00:00
</header>
2016-03-20 04:00:40 +00:00
<div className="pane__body">
2016-03-18 21:31:45 +00:00
<ul className="sidebar-items">
2016-03-20 04:00:40 +00:00
<li className="grid">
<div className="form-control col">
<input type="text" placeholder="Filter Requests"/>
</div>
<button className="btn" onClick={(e) => props.addRequest()}>
<i className="fa fa-plus-circle"></i>
</button>
</li>
</ul>
<ul className="sidebar-items">
{props.requests.all.map((request) => {
const isActive = request.id === props.requests.active.id;
return (
<li key={request.id} className={'sidebar-item ' + (isActive ? 'active': '')}>
2016-03-20 04:47:43 +00:00
<a href="#" onClick={() => {props.activateRequest(request)}}>{request.name}</a>
2016-03-20 04:00:40 +00:00
</li>
);
2016-03-18 21:31:45 +00:00
})}
</ul>
</div>
2016-03-18 00:36:00 +00:00
</aside>
);
2016-03-20 04:00:40 +00:00
Sidebar.propTypes = {
2016-03-20 04:47:43 +00:00
activateRequest: PropTypes.func.isRequired,
2016-03-20 04:00:40 +00:00
requests: PropTypes.object.isRequired,
loading: PropTypes.bool.isRequired
};
2016-03-18 00:36:00 +00:00
export default Sidebar;