Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Jul 10, 2024
1 parent abaca7d commit 491cc0e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/components/ha-grid-size-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class HaGridSizeEditor extends LitElement {

@property({ attribute: false }) public value?: GridSizeValue;

@property({ attribute: false }) public rows = 6;
@property({ attribute: false }) public rows = 8;

@property({ attribute: false }) public columns = 4;

Expand Down Expand Up @@ -205,7 +205,7 @@ export class HaGridSizeEditor extends LitElement {
.preview {
position: relative;
grid-area: preview;
aspect-ratio: 1 / 1;
aspect-ratio: 1 / 1.2;
}
.preview > div {
position: absolute;
Expand Down
16 changes: 6 additions & 10 deletions src/panels/lovelace/card-features/hui-card-feature.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { HassEntity } from "home-assistant-js-websocket";
import { CSSResultGroup, LitElement, css, html, nothing } from "lit";
import { LitElement, html, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { HomeAssistant } from "../../../types";
import type { HuiErrorCard } from "../cards/hui-error-card";
Expand All @@ -17,15 +17,15 @@ export class HuiCardFeature extends LitElement {

@property({ attribute: false }) public color?: string;

private _featuresElement?: LovelaceCardFeature | HuiErrorCard;
private _element?: LovelaceCardFeature | HuiErrorCard;

private _getFeatureElement(feature: LovelaceCardFeatureConfig) {
if (!this._featuresElement) {
this._featuresElement = createCardFeatureElement(feature);
return this._featuresElement;
if (!this._element) {
this._element = createCardFeatureElement(feature);
return this._element;
}

return this._featuresElement;
return this._element;
}

protected render() {
Expand All @@ -42,10 +42,6 @@ export class HuiCardFeature extends LitElement {
}
return html`${element}`;
}

static get styles(): CSSResultGroup {
return css``;
}
}

declare global {
Expand Down
2 changes: 1 addition & 1 deletion src/panels/lovelace/card-features/hui-card-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class HuiCardFeatures extends LitElement {
flex-direction: column;
padding: var(--feature-padding);
padding-top: 0px;
gap: 12px;
gap: var(--feature-padding);
width: 100%;
height: 100%;
box-sizing: border-box;
Expand Down
5 changes: 1 addition & 4 deletions src/panels/lovelace/cards/hui-tile-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,6 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
.stateObj=${stateObj}
.color=${this._config.color}
.features=${this._config.features}
style=${styleMap({
"--feature-count": this._config.features.length.toString(),
})}
></hui-card-features>
`
: nothing}
Expand Down Expand Up @@ -475,7 +472,7 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
border-color 180ms ease-in-out;
display: flex;
flex-direction: column;
justify-content: space-evenly;
justify-content: space-between;
}
ha-card.active {
--tile-color: var(--state-icon-color);
Expand Down

0 comments on commit 491cc0e

Please sign in to comment.