Skip to content

Commit

Permalink
fix: icons not centered on calendar view
Browse files Browse the repository at this point in the history
  • Loading branch information
marksie1988 committed Sep 5, 2023
1 parent 58eb9c1 commit 114bbde
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@material/mwc-select": "^0.27.0",
"@material/mwc-switch": "^0.27.0",
"@material/mwc-textfield": "^0.27.0",
"@mdi/js": "^7.2.96",
"@webcomponents/webcomponentsjs": "^2.8.0",
"custom-card-helpers": "^1.9.0",
"dayjs": "^1.11.9",
Expand Down
13 changes: 7 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { HomeAssistant, LovelaceCardEditor, getLovelace } from 'custom-card-help
import { formatTime } from './helpers/format-time';
import { groupEventsByDay, getEventMode, getCalendarMode } from './lib/event.func';
import { styles } from './style';
import { mdiChevronLeft, mdiChevronRight } from "@mdi/js";

// DayJS for managing date information
import dayjs from 'dayjs';
Expand Down Expand Up @@ -498,23 +499,23 @@ export class AtomicCalendarRevive extends LitElement {
<ha-icon-button
class="prev"
style="--mdc-icon-color: ${this._config.calDateColor}"
icon="mdi:chevron-left"
.path=${mdiChevronLeft}
.label=${this.hass.localize('ui.common.previous')}
@click="${() => this.handleMonthChange(-1)}"
title=${this.hass.localize('ui.common.previous')}
>
<ha-icon icon="mdi:chevron-left"></ha-icon>
</ha-icon-button>
<span class="date" style="text-decoration: none; color: ${this._config.calDateColor};">
${this.selectedMonth.format('MMMM')} ${this.selectedMonth.format('YYYY')}
</span>
<ha-icon-button
class="next"
style="--mdc-icon-color: ${this._config.calDateColor}"
icon="mdi:chevron-right"
.path=${mdiChevronRight}
.label=${this.hass.localize('ui.common.next')}
@click="${() => this.handleMonthChange(1)}"
title=${this.hass.localize('ui.common.next')}
>
<ha-icon icon="mdi:chevron-right"></ha-icon>
</ha-icon-button>
</div>`;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/common.html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import dayjs, { Dayjs } from "dayjs";
import { html } from "lit";
import { atomicCardConfig } from "../types/config";
import EventClass from "./event.class";
import { mdiCalendar } from "@mdi/js";

export function showCalendarLink(config, selectedMonth) {
if (!config.disableCalLink) {
return html`<div class="calIconSelector">
<ha-icon-button
icon="mdi:calendar"
.path=${mdiCalendar}
style="--mdc-icon-color: ${config.calDateColor}"
onClick="window.open('https://calendar.google.com/calendar/r/month/${selectedMonth.format('YYYY')}/${selectedMonth.format('MM')}/1'), '${config.linkTarget}'"
>
<ha-icon icon="mdi:calendar"></ha-icon>
</ha-icon-button>
</div>`;
}
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,11 @@
"@material/theme" "14.0.0-canary.53b3cad2f.0"
tslib "^2.1.0"

"@mdi/js@^7.2.96":
version "7.2.96"
resolved "https://registry.yarnpkg.com/@mdi/js/-/js-7.2.96.tgz#a2a20be740a75e65c8b8b9e12a2b699c06a9208f"
integrity sha512-paR9M9ZT7rKbh2boksNUynuSZMHhqRYnEZOm/KrZTjQ4/FzyhjLHuvw/8XYzP+E7fS4+/Ms/82EN1pl/OFsiIA==

"@nicolo-ribaudo/[email protected]":
version "2.1.8-no-fsevents.3"
resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b"
Expand Down

0 comments on commit 114bbde

Please sign in to comment.