MCPcopy Create free account
hub / github.com/custom-cards/button-entity-row / render

Method render

button-entity-row.js:45–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43 }
44
45 render() {
46 return html`
47 ${this.rows.map(row => {
48 return html`
49 <div class="flex-box">
50 ${row.map(button => {
51 const entityState = this.hass.states[button.entityId] || {}
52 const icon = this._getCurrentIcon(button, entityState)
53 const style = this._getCurrentStyle(button, entityState)
54 const iconStyle = this._getCurrentIconStyle(button, entityState)
55 const name =
56 button.name || (!icon && entityState.attributes ? entityState.attributes.friendly_name : null)
57
58 return html`
59 <paper-button
60 @click="${() => this._handleButtonClick(button)}"
61 style="${style}"
62 class="${this._getCurrentClass(entityState)}"
63 >
64 ${icon &&
65 html`
66 <ha-icon icon="${icon}" style="${iconStyle} ${name ? "padding-right: 5px;" : ""}"></ha-icon>
67 `}
68 ${name}
69 <paper-ripple center class="${name ? "" : "circle"}"></paper-ripple>
70 </paper-button>
71 `
72 })}
73 </div>
74 `
75 })}
76 `
77 }
78
79 setConfig(config) {
80 config = JSON.parse(JSON.stringify(config))

Callers

nothing calls this directly

Calls 5

_getCurrentIconMethod · 0.95
_getCurrentStyleMethod · 0.95
_getCurrentIconStyleMethod · 0.95
_handleButtonClickMethod · 0.95
_getCurrentClassMethod · 0.95

Tested by

no test coverage detected