mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 18:32:50 +00:00
working on sidebar/sensors
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
import React from 'react';
|
||||
import 'whatwg-fetch';
|
||||
|
||||
import './SensorList.scss';
|
||||
|
||||
export default class SensorList extends React.Component {
|
||||
|
||||
insertSensorData = (sensor, index) => {
|
||||
const date = new Date(sensor.updated);
|
||||
|
||||
return (
|
||||
<div key={index}>
|
||||
<h3>{sensor.location}</h3>
|
||||
<p>{sensor.temperature}</p>
|
||||
<p>{date.toString()}</p>
|
||||
<div key={index} class="row">
|
||||
<div class="item"><h1>{sensor.temperature}</h1><p>Connected</p></div>
|
||||
<div class="item">
|
||||
<h3>{sensor.location}</h3>
|
||||
<p>{date.toString()}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -18,7 +22,9 @@ export default class SensorList extends React.Component {
|
||||
const list = this.props.list;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div class="SensorList">
|
||||
<h2>Sensors</h2>
|
||||
<hr/>
|
||||
{list.map(this.insertSensorData)}
|
||||
</div>
|
||||
)
|
||||
|
||||
11
client/js/components/sensors/SensorList.scss
Normal file
11
client/js/components/sensors/SensorList.scss
Normal file
@@ -0,0 +1,11 @@
|
||||
.SensorList{
|
||||
.row{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.item + .item{
|
||||
margin-left: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user