forked from DBuit/custom-sonos-card
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: missing padding for grouping button
- Loading branch information
Showing
3 changed files
with
63 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { css, html, LitElement, nothing } from 'lit'; | ||
import { property } from 'lit/decorators.js'; | ||
|
||
export class GroupingButton extends LitElement { | ||
@property() icon!: string; | ||
@property() name!: string; | ||
|
||
render() { | ||
const iconAndName = (!!this.icon && !!this.name) || nothing; | ||
return html` | ||
<ha-control-button> | ||
${this.icon ? html` <ha-icon icon-and-name=${iconAndName} .icon=${this.icon}></ha-icon>` : ''} | ||
${this.name ? html`<span>${this.name}</span>` : ''} | ||
</ha-control-button> | ||
`; | ||
} | ||
|
||
static get styles() { | ||
return css` | ||
ha-control-button { | ||
width: fit-content; | ||
--control-button-background-color: var(--accent-color); | ||
--control-button-icon-color: var(--secondary-text-color); | ||
} | ||
ha-icon { | ||
padding-left: 1rem; | ||
padding-right: 1rem; | ||
} | ||
ha-icon[icon-and-name] { | ||
padding-right: 0; | ||
} | ||
span { | ||
padding-right: 1rem; | ||
padding-left: 1rem; | ||
font-weight: bold; | ||
} | ||
`; | ||
} | ||
} | ||
|
||
customElements.define('sonos-grouping-button', GroupingButton); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters