mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
* Fix eslint import extension * Update eslint hound * Enable no unresolved for normal usage
40 lines
859 B
JavaScript
40 lines
859 B
JavaScript
import { h, Component } from 'preact';
|
|
|
|
import { onChangeEvent } from '../../util/event.js';
|
|
|
|
export default class StateCondition extends Component {
|
|
constructor() {
|
|
super();
|
|
|
|
this.onChange = onChangeEvent.bind(this, 'condition');
|
|
}
|
|
|
|
/* eslint-disable camelcase */
|
|
render({ condition }) {
|
|
const { entity_id, state } = condition;
|
|
const cndFor = condition.for;
|
|
return (
|
|
<div>
|
|
<paper-input
|
|
label="Entity Id"
|
|
name="entity_id"
|
|
value={entity_id}
|
|
onChange={this.onChange}
|
|
/>
|
|
<paper-input
|
|
label="State"
|
|
name="state"
|
|
value={state}
|
|
onChange={this.onChange}
|
|
/>
|
|
{cndFor && <pre>For: {JSON.stringify(cndFor, null, 2)}</pre>}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
StateCondition.defaultConfig = {
|
|
entity_id: '',
|
|
state: '',
|
|
};
|