Skip to content

Commit

Permalink
chore: Update CSS styles for responsive layout and date input buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocjohn committed Aug 3, 2024
1 parent a9da8bf commit dfdade9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ ha-card {
}

@media screen and (max-width: 800px) {
ha-card {
font-size: 1.2vh !important;
}
.moon-image {
width: 100%;
max-width: 100px !important;
Expand Down Expand Up @@ -222,8 +219,9 @@ section {
width: 100%;
position: relative;
justify-content: space-around;
align-items: baseline;
align-items: normal;
gap: 1rem;
text-wrap: nowrap;
}
.date-input-label {
display: block;
Expand Down
7 changes: 4 additions & 3 deletions src/lunar-phase-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ export class LunarPhaseCard extends LitElement {
if (!this.hass || !this.config) {
return html``;
}
const isCalendar = this._activeCard === 'calendar';
const isCalendar = this._activeCard === 'calendar' || window.matchMedia('(max-width: 600px)').matches;

return html`
<ha-card class=${this._computeClasses()}>
${this.renderHeader()}
Expand Down Expand Up @@ -263,8 +264,8 @@ export class LunarPhaseCard extends LitElement {
const dateInput = html`<div class="date-input-wrapper">
<input type="date" class="date-input" .value=${this.selectedDate} @input=${this._handleDateChange} />
<button @click=${() => this.updateDate('today')} class="date-input-btn click-shrink">Today</button>
<button @click=${() => this.updateDate('prev')} class="date-input-btn click-shrink">Previous day</button>
<button @click=${() => this.updateDate('next')} class="date-input-btn click-shrink">Next day</button>
<button @click=${() => this.updateDate('prev')} class="date-input-btn click-shrink"><</button>
<button @click=${() => this.updateDate('next')} class="date-input-btn click-shrink">></button>
</div>`;

return html`
Expand Down

0 comments on commit dfdade9

Please sign in to comment.