mirror of
https://github.com/GeorgeSG/lovelace-time-picker-card.git
synced 2026-09-06 02:18:44 +00:00
Update styles
This commit is contained in:
+9
-13
@@ -1,5 +1,9 @@
|
|||||||
import { css } from 'lit-element';
|
import { css } from 'lit-element';
|
||||||
|
|
||||||
|
export const styleVariables = {
|
||||||
|
'--time-picker-card-background-color': 'rgb(37, 47, 68)',
|
||||||
|
};
|
||||||
|
|
||||||
export const styles = css`
|
export const styles = css`
|
||||||
.time-picker-ha-card {
|
.time-picker-ha-card {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
@@ -16,27 +20,19 @@ export const styles = css`
|
|||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-picker-icon-up,
|
.time-picker-icon {
|
||||||
.time-picker-icon-down {
|
width: 30px;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-picker-icon-up {
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.time-picker-icon-down {
|
|
||||||
margin-top: 8px;
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.time-input {
|
.time-input {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
background: var(--card-background-color, transparent);
|
background: var(--time-picker-card-background-color);
|
||||||
border: 0;
|
border: 0;
|
||||||
color: var(--text-color, #fff);
|
color: var(--text-color, #fff);
|
||||||
border-bottom: 1px solid var(--text-color, #fff);
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-6
@@ -4,12 +4,12 @@ import { CSSResult, customElement, html, LitElement, property, TemplateResult }
|
|||||||
import { CARD_VERSION } from './const';
|
import { CARD_VERSION } from './const';
|
||||||
import { Hour, Minute, TimeUnit } from './models';
|
import { Hour, Minute, TimeUnit } from './models';
|
||||||
import { Partial } from './partials';
|
import { Partial } from './partials';
|
||||||
import { styles } from './styles';
|
import { styles, styleVariables } from './styles';
|
||||||
import { Direction, TimePickerCardConfig } from './types';
|
import { Direction, TimePickerCardConfig } from './types';
|
||||||
|
|
||||||
console.info(
|
console.info(
|
||||||
`%c TIME-PICKER-CARD \n%c Version ${CARD_VERSION} `,
|
`%c TIME-PICKER-CARD \n%c Version ${CARD_VERSION} `,
|
||||||
'color: darkgreen; font-weight: bold; background: black',
|
'color: orange; font-weight: bold; background: black',
|
||||||
'color: white; font-weight: bold; background: dimgray'
|
'color: white; font-weight: bold; background: dimgray'
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -44,6 +44,7 @@ export class TimePickerCard extends LitElement {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setStyleVarialbes();
|
||||||
this.hour = new Hour(this.entity?.attributes.hour ?? 0, this.config.hour_step);
|
this.hour = new Hour(this.entity?.attributes.hour ?? 0, this.config.hour_step);
|
||||||
this.minute = new Minute(this.entity?.attributes.minute ?? 0, this.config.minute_step);
|
this.minute = new Minute(this.entity?.attributes.minute ?? 0, this.config.minute_step);
|
||||||
|
|
||||||
@@ -114,10 +115,8 @@ export class TimePickerCard extends LitElement {
|
|||||||
this.callService();
|
this.callService();
|
||||||
};
|
};
|
||||||
|
|
||||||
const className = `time-picker-icon-${direction}`;
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class=${className} @click=${onIconClick}>
|
<div class="time-picker-icon" @click=${onIconClick}>
|
||||||
<ha-icon .icon="mdi:arrow-${direction}"></ha-icon>
|
<ha-icon .icon="mdi:arrow-${direction}"></ha-icon>
|
||||||
<mwc-ripple id="ripple"></mwc-ripple>
|
<mwc-ripple id="ripple"></mwc-ripple>
|
||||||
</div>
|
</div>
|
||||||
@@ -137,6 +136,12 @@ export class TimePickerCard extends LitElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private setStyleVarialbes(): void {
|
||||||
|
Object.entries(styleVariables).forEach(([variable, value]) =>
|
||||||
|
this.style.setProperty(variable, value)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
static get styles(): CSSResult {
|
static get styles(): CSSResult {
|
||||||
return styles;
|
return styles;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user