Add speed limit dropdown

This commit is contained in:
John Furrow
2016-01-03 20:58:18 -05:00
parent 95491b7291
commit bdc5e147ef
3 changed files with 214 additions and 108 deletions
@@ -1,17 +1,10 @@
import React from 'react';
import ClientActions from '../../actions/ClientActions';
import Dropdown from '../generic/Dropdown';
import Icon from '../icons/Icon';
class Sidebar extends React.Component {
constructor() {
super();
this.state = {
isEpanded: false
};
}
getDropdownHeader() {
return (
<a className="client-stats client-stat--limits">
@@ -22,57 +15,144 @@ class Sidebar extends React.Component {
getMenuItems() {
return [
{
displayName: '1',
property: '1'
},
{
displayName: '2',
property: '2'
},
{
displayName: '3',
property: '3'
},
{
displayName: '4',
property: '4'
},
{
displayName: '5',
property: '5'
},
{
displayName: '6',
property: '6'
},
{
displayName: '7',
property: '7'
},
{
displayName: '8',
property: '8'
},
{
displayName: '9',
property: '9'
},
{
displayName: '10',
property: '10'
}
[
{
displayName: '0.25',
property: 'upload',
value: '256'
},
{
displayName: '0.5',
property: 'upload',
value: '512'
},
{
displayName: '1',
property: 'upload',
value: '1024'
},
{
displayName: '10',
property: 'upload',
value: '10240'
},
{
displayName: '100',
property: 'upload',
value: '102400'
},
{
displayName: '1000',
property: 'upload',
value: '1048576'
},
{
displayName: '5',
property: 'upload',
value: '5'
},
{
displayName: '6',
property: 'upload',
value: '6'
},
{
displayName: '7',
property: 'upload',
value: '7'
},
{
displayName: '8',
property: 'upload',
value: '8'
},
{
displayName: '9',
property: 'upload',
value: '9'
},
{
displayName: '10',
property: 'upload',
value: '10'
}
], [
{
displayName: '0.25',
property: 'download',
value: '256'
},
{
displayName: '0.5',
property: 'download',
value: '512'
},
{
displayName: '1',
property: 'download',
value: '1024'
},
{
displayName: '10',
property: 'download',
value: '10240'
},
{
displayName: '100',
property: 'download',
value: '102400'
},
{
displayName: '1000',
property: 'download',
value: '1048576'
},
{
displayName: '5',
property: 'download',
value: '5'
},
{
displayName: '6',
property: 'download',
value: '6'
},
{
displayName: '7',
property: 'download',
value: '7'
},
{
displayName: '8',
property: 'download',
value: '8'
},
{
displayName: '9',
property: 'download',
value: '9'
},
{
displayName: '10',
property: 'download',
value: '10'
}
]
];
}
handleItemSelect(data) {
ClientActions.setThrottle(data.property, data.value);
}
render() {
return (
<div className="client-stats sidebar__item">
<div className="client-stats sidebar__item sidebar__item--speed-limit">
<Dropdown
handleItemSelect={this.handleItemSelect}
header={this.getDropdownHeader()}
menuItems={this.getMenuItems()}
selectedItem={'1'}
selectedItem={'10000'}
/>
</div>
);