Skip to content

Commit

Permalink
refactor: move purifier image to lit
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdovhan committed Apr 20, 2022
1 parent 4f745f7 commit 8c9ca6c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/purifier-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import './purifier-card-editor';
import localize from './localize';
import styles from './styles';
import { version } from '../package.json';
import workingImg from './images/purifier-working.gif';
import standbyImg from './images/purifier-standby.png';

console.info(
`%c PURIFIER-CARD %c ${version} `,
Expand Down Expand Up @@ -235,7 +237,7 @@ class PurifierCard extends LitElement {
} = this.entity;

const disabled = state !== 'on';
const stateClass = !disabled ? 'working' : 'standby';
const image = !disabled ? workingImg : standbyImg;

return html`
<div class="slider">
Expand All @@ -246,7 +248,8 @@ class PurifierCard extends LitElement {
@value-changed=${(e) => this.handlePercentage(e)}
>
</round-slider>
<div class="slider-center image ${stateClass}">
<img src=${image} alt="purifier is ${state}" class="image" />
<div class="slider-center">
<div class="slider-content">
${this.renderAQI()}
</div>
Expand Down

0 comments on commit 8c9ca6c

Please sign in to comment.