Skip to content

Commit

Permalink
[FEATURE] Add optional card title
Browse files Browse the repository at this point in the history
Resolves: #97
  • Loading branch information
Rudy Gnodde committed Jul 10, 2024
1 parent 88e407c commit 7341b5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Custom Home Assistant card displaying a responsive overview of multiple days wit
| Name | Type | Default | Supported options | Description | Version |
|-------------------------|------------------|----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|---------|
| `type` | string | **Required** | `custom:week-planner-card` | Type of the card | 1.0.0 |
| `title` | string | optional | Any string | Card title | 1.6.0 |
| `days` | number \| string | 7 | Any positive integer number \| `month` | The number of days to show | 1.0.0 |
| `startingDay` | string | `today` | `today` \| `tomorrow` \| `yesterday` \| `sunday` \| `monday` \| `tuesday` \| `wednesday` \| `thursday` \| `friday` \| `saturday` \| `month` | Day to start with | 1.2.0 |
| `hideWeekend` | boolean | false | `false` \| `true` | Do not show Saturday and Sunday | 1.2.0 |
Expand Down
5 changes: 5 additions & 0 deletions src/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export class WeekPlannerCard extends LitElement {
throw new Error('No calendars are configured');
}

this._title = config.title ?? null;
this._calendars = config.calendars;
this._weather = this._getWeatherConfig(config.weather);
this._numberOfDays = this._getNumberOfDays(config.days ?? 7);
Expand Down Expand Up @@ -190,6 +191,10 @@ export class WeekPlannerCard extends LitElement {
html`<ha-alert alert-type="error">${this._error}</ha-alert>` :
''
}
${this._title ?
html`<h1 class="card-title">${this._title}</h1>` :
''
}
<div class="container">
${this._renderDays()}
</div>
Expand Down

0 comments on commit 7341b5c

Please sign in to comment.