Skip to content

Commit

Permalink
Specify card size (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkissling authored Sep 26, 2023
1 parent b4193c5 commit 4c58023
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/clock-weather-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ const gradientMap: Map<number, Rgb> = new Map()
@customElement('clock-weather-card')
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export class ClockWeatherCard extends LitElement {
public static getStubConfig(): Record<string, unknown> {
return {};
}

// https://lit.dev/docs/components/properties/
@property({ attribute: false }) public hass!: HomeAssistant;

Expand All @@ -77,6 +73,14 @@ export class ClockWeatherCard extends LitElement {
setTimeout(() => { this.currentDate = new Date() }, msToNextMinute);
}

public static getStubConfig(): Record<string, unknown> {
return {};
}

public getCardSize(): number {
return 3 + roundUp(this.config.forecast_days / 2);
}

// https://lit.dev/docs/components/properties/#accessors-custom
public setConfig(config: ClockWeatherCardConfig): void {
if (!config) {
Expand Down

0 comments on commit 4c58023

Please sign in to comment.