Update web-starter

This commit is contained in:
Michael Jackson
2016-07-20 12:26:15 -07:00
parent 7734f13091
commit 51ace69ccb
12 changed files with 127 additions and 29 deletions

View File

@ -4,6 +4,11 @@ import { findDOMNode } from 'react-dom'
import Window from './Window'
class Layout extends React.Component {
static propTypes = {
location: PropTypes.object,
children: PropTypes.node
}
state = {
underlineLeft: 0,
underlineWidth: 0,

View File

@ -5,7 +5,8 @@ class NumberTextInput extends React.Component {
static propTypes = {
value: PropTypes.number,
parseNumber: PropTypes.func,
formatNumber: PropTypes.func
formatNumber: PropTypes.func,
onChange: PropTypes.func
}
static defaultProps = {

View File

@ -1,5 +1,4 @@
import React, { PropTypes } from 'react'
import { findDOMNode } from 'react-dom'
import formatBytes from 'byte-size'
import formatDate from 'date-fns/format'
import parseDate from 'date-fns/parse'
@ -21,8 +20,12 @@ const addValues = (a, b) => {
}
class Stats extends React.Component {
static propTypes = {
stats: PropTypes.object
}
static defaultProps = {
stats: window.NPMCDN_STATS
stats: window.npmcdnStats
}
state = {
@ -83,13 +86,13 @@ class Stats extends React.Component {
})
topContinents.forEach(continent => {
const name = ContinentsIndex[continent]
const continentName = ContinentsIndex[continent]
const { countries, requests, bandwidth } = continentData[continent]
if (bandwidth !== 0) {
regionRows.push(
<tr key={continent} className="continent-row">
<td>{ContinentsIndex[continent]}</td>
<td>{continentName}</td>
<td>{formatNumber(requests)} ({formatPercent(requests / totalRequests)}%)</td>
<td>{formatBytes(bandwidth)} ({formatPercent(bandwidth / totalBandwidth)}%)</td>
</tr>