create components folder

This commit is contained in:
Skip R. 2018-07-13 19:06:38 -07:00
parent 0767ed90c0
commit 1b74c3da3f
No known key found for this signature in database
GPG key ID: 1508C19D7436A26D
10 changed files with 21 additions and 14 deletions

View file

@ -3,8 +3,8 @@ import React, { Component } from 'react';
import './App.css';
import Service from './Service.js';
import ServicePlaceholder from './ServicePlaceholder.js';
import OP from './ws/op.js';
import { log } from './util.js';
import OP from '../ws/op.js';
import { log } from '../util.js';
const DOMAIN = 'https://elstatus.stayathomeserver.club';
// const ENDPOINT = 'http://localhost:8069/api/status'
@ -106,7 +106,6 @@ export default class App extends Component {
}
}
render() {
const metrics = !this.state.metrics ? null : (
<div className="services">
@ -123,21 +122,23 @@ export default class App extends Component {
</div>
);
return (
<div className="dashboard">
<h1>elstatus</h1>
{this.state.error ? (
<div className="error">
Error: {this.state.error}
</div>
) : null}
{this.state.loading ? (
<React.Fragment>
<ServicePlaceholder />
<ServicePlaceholder />
<ServicePlaceholder />
</React.Fragment>
) : null}
{this.state.error ? (
<div>Error: {this.state.error}</div>
) : null}
{metrics}
) : metrics}
</div>
);
}

View file

@ -3,8 +3,8 @@ import PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Graph from './Graph.js';
import './Service.css';
import Graph from './Graph.js';
const Service = ({ graph, name, status, latency, description }) => (
<div className="service">

View file

@ -2,6 +2,10 @@ html, body {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin: 0;
padding: 2rem;
@ -12,6 +16,8 @@ h1:first-child {
margin-top: 0;
}
*, *:before, *:after {
box-sizing: inherit;
.error {
background: pink;
padding: 1rem;
border-radius: 0.15rem;
}

View file

@ -1,9 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import register from './icons.js';
import './index.css';
import App from './App';
import App from './components/App';
import register from './icons.js';
register();