add proptypes to graph comp

This commit is contained in:
slice 2018-07-13 19:40:45 -07:00
parent 50c479d6ea
commit 37dd98026d
No known key found for this signature in database
GPG Key ID: 1508C19D7436A26D
2 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ms from 'ms'; import ms from 'ms';
import { ResponsiveLine } from '@nivo/line'; import { ResponsiveLine } from '@nivo/line';
@ -6,6 +7,10 @@ import { ResponsiveLine } from '@nivo/line';
import './Graph.css'; import './Graph.css';
export default class Graph extends Component { export default class Graph extends Component {
static propTypes = {
data: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)).isRequired,
}
state = { state = {
screenWidth: window.innerWidth, screenWidth: window.innerWidth,
} }

View File

@ -26,7 +26,7 @@ const Service = ({ graph, name, status, latency, description }) => (
<p className="description"> <p className="description">
{description} {description}
</p> </p>
{graph ? <Graph width={500} height={175} data={graph} /> : null} {graph ? <Graph data={graph} /> : null}
</div> </div>
); );