53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
|
/**
|
||
|
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>
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export class DefaultDimmer extends Component{
|
||
|
// 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>
|
||
|
)
|
||
|
}
|
||
|
}
|