diff --git a/package.json b/package.json
index 652ffee..5f484f7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "reacticz",
- "version": "0.1.20",
+ "version": "0.1.21",
"license": "Apache-2.0",
"repository": {
"type": "git",
diff --git a/public/index.html b/public/index.html
index 5422353..9c980d6 100644
--- a/public/index.html
+++ b/public/index.html
@@ -112,6 +112,13 @@
+
+
+
+
+
+
+
diff --git a/src/widgets/DeviceWidget.js b/src/widgets/DeviceWidget.js
index d99d535..fdc04ac 100644
--- a/src/widgets/DeviceWidget.js
+++ b/src/widgets/DeviceWidget.js
@@ -13,6 +13,7 @@ import SmokeSensorWidget from './SmokeSensorWidget'
import SwitchOnOff from './SwitchOnOff'
import SwitchBlinds from './SwitchBlinds'
import SwitchDimmer from './SwitchDimmer'
+import SwitchLock from './SwitchLock'
import SwitchRGBW from './SwitchRGBW'
import SwitchSelector from './SwitchSelector'
import TemperatureWidget from './TemperatureWidget'
@@ -66,6 +67,9 @@ class DeviceWidget extends Component {
case 'Door Contact' :
return
+ case 'Door Lock' :
+ return ;
case 'Dimmer' :
if (device.stype === 'RGBW') {
return * {
+ flex: 2;
+ margin: 0 5px;
+ overflow: hidden;
+}
+
+.SwitchLock .lockicon {
+ height: 70%;
+ min-width: 35px;
+ flex: 1;
+ opacity: 1;
+ transform: scaleX(-1);
+}
+
diff --git a/src/widgets/SwitchLock.js b/src/widgets/SwitchLock.js
new file mode 100644
index 0000000..119f79d
--- /dev/null
+++ b/src/widgets/SwitchLock.js
@@ -0,0 +1,22 @@
+import React from 'react';
+import SwitchOnOff from './SwitchOnOff';
+import './SwitchLock.css';
+import './SwitchOnOff.css';
+
+class SwitchLock extends SwitchOnOff {
+
+ render() {
+ const valueText = this.props.value === 0 ? 'Unlocked' : 'Locked';
+ const iconId = this.props.value === 0 ? 'exit-to-app' : 'lock-outline';
+ return (
+
+ );
+ }
+
+}
+
+export default SwitchLock
diff --git a/src/widgets/SwitchOnOff.js b/src/widgets/SwitchOnOff.js
index 4f07bf7..fedd196 100644
--- a/src/widgets/SwitchOnOff.js
+++ b/src/widgets/SwitchOnOff.js
@@ -49,14 +49,15 @@ class SwitchOnOff extends Component {
}
}
- getButtonStyle() {
+ getButtonStyle(swapStyles = false) {
const theme = this.props.theme;
if (!theme) {
return {};
}
const style = {
- color: theme.textOn,
- background: this.props.readOnly ? theme.unlockedBackground : theme.buttonOn
+ color: swapStyles ? theme.textOff : theme.textOn,
+ fill: swapStyles ? theme.textOff : theme.textOn,
+ background: this.props.readOnly ? theme.unlockedBackground : ( swapStyles ? theme.buttonOff : theme.buttonOn )
}
const gradient = 'repeating-linear-gradient(-45deg, _corner, _corner 20%, _bg 20%, _bg 80%, _corner 80%, _corner 100%)';
if (this.props.pushOn && this.props.sceneType) {
@@ -69,8 +70,9 @@ class SwitchOnOff extends Component {
style.background = this.props.readOnly ? theme.unlockedBackground : gradient.replace(/_corner/g, theme.buttonOn).replace(/_bg/g, theme.buttonOff);
}
if (this.props.valueText === "Off" || this.props.value === 0) {
- style.color = theme.textOff;
- style.background = this.props.readOnly ? theme.unlockedBackground : theme.buttonOff;
+ style.color = swapStyles ? theme.textOn : theme.textOff;
+ style.fill = swapStyles ? theme.textOn : theme.textOff;
+ style.background = this.props.readOnly ? theme.unlockedBackground : ( swapStyles ? theme.buttonOn : theme.buttonOff );
}
return style;
}