Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(select-card) #885

Merged
merged 15 commits into from
Jan 10, 2023
Prev Previous commit
Next Next commit
select height reduced to match other mushroom cards
  • Loading branch information
PaoloTK committed Dec 4, 2022
commit ec308204f41e9d5f1c528b645e4859494d1075d6
1 change: 1 addition & 0 deletions src/cards/select-card/controls/select-option-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class SelectOptionControl extends LitElement {
static get styles(): CSSResultGroup {
return css`
mushroom-select {
--select-height: 42px;
width: 100%;
}
`;
Expand Down
13 changes: 10 additions & 3 deletions src/shared/form/mushroom-select.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SelectBase } from "@material/mwc-select/mwc-select-base";
import { styles } from "@material/mwc-select/mwc-select.css";
import { html, nothing } from "lit";
import { css, html, nothing } from "lit";
import { customElement, property } from "lit/decorators.js";
import { debounce, nextRender } from "../../ha";

Expand All @@ -17,8 +17,6 @@ export class MushroomSelect extends SelectBase {
return html`<span class="mdc-select__icon"><slot name="icon"></slot></span>`;
}

static override styles = [styles];

connectedCallback() {
super.connectedCallback();
window.addEventListener("translations-updated", this._translationsUpdated);
Expand All @@ -33,6 +31,15 @@ export class MushroomSelect extends SelectBase {
await nextRender();
this.layoutOptions();
}, 500);

static override styles = [
styles,
css`
.mdc-select__anchor {
height: var(--select-height, auto) !important;
}
`,
];
}

declare global {
Expand Down