2020-03-15 14:50:25 +00:00
|
|
|
/**
|
|
|
|
Users can add dimmers, a particular kind of switch that can also modify the intensity level of a given light.
|
|
|
|
There are two types of dimmers:
|
|
|
|
• A dimmer with state stores a given intensity level and sets the light to that level. <-- StatefulDimmer
|
|
|
|
• A dimmer without state can just increase or decrease the intensity of a light. <-- DefualtDimmer
|
|
|
|
|
|
|
|
The user can change the state of a dimmer through an intuitive UI in SmartHut .
|
|
|
|
**/
|
|
|
|
|
|
|
|
import React, {Component} from 'react';
|
|
|
|
|
|
|
|
export class StatefulDimmer extends Component{
|
|
|
|
constructor(props){
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
intensityLevel : 0,
|
|
|
|
pointingLDevices:[]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return(
|
|
|
|
<div>
|
|
|
|
This is a Dimmer
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-17 15:20:43 +00:00
|
|
|
export default class DefaultDimmer extends Component{
|
2020-03-15 14:50:25 +00:00
|
|
|
// As far as I am concern, even though this dimmer doesn't have state, internally it's needed
|
|
|
|
constructor(props){
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
pointingDevices :[]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return(
|
|
|
|
<div>
|
|
|
|
This is a Dimmer
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|