Make time a label without icon (#8649)

This commit is contained in:
Paulus Schoutsen 2021-03-15 01:39:29 -07:00 committed by GitHub
parent a465254418
commit 55e58f8d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -13,6 +13,8 @@ import "../ha-svg-icon";
@customElement("ha-timeline") @customElement("ha-timeline")
class HaTimeline extends LitElement { class HaTimeline extends LitElement {
@property({ type: Boolean, reflect: true }) public label = false;
@property({ type: Boolean }) public lastItem = false; @property({ type: Boolean }) public lastItem = false;
@property({ type: String }) public icon?: string; @property({ type: String }) public icon?: string;
@ -24,7 +26,11 @@ class HaTimeline extends LitElement {
protected render() { protected render() {
return html` return html`
<div class="timeline-start"> <div class="timeline-start">
<ha-svg-icon .path=${this.icon || mdiCircleOutline}></ha-svg-icon> ${this.label
? ""
: html`
<ha-svg-icon .path=${this.icon || mdiCircleOutline}></ha-svg-icon>
`}
${this.lastItem ? "" : html`<div class="line"></div>`} ${this.lastItem ? "" : html`<div class="line"></div>`}
</div> </div>
<div class="content"> <div class="content">
@ -63,11 +69,17 @@ class HaTimeline extends LitElement {
:host(:not([lastItem])) { :host(:not([lastItem])) {
min-height: 50px; min-height: 50px;
} }
:host([label]) {
margin-top: -8px;
font-style: italic;
color: var(--timeline-label-color, var(--secondary-text-color));
}
.timeline-start { .timeline-start {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-right: 4px; margin-right: 8px;
width: 24px;
} }
ha-svg-icon { ha-svg-icon {
color: var( color: var(
@ -90,6 +102,10 @@ class HaTimeline extends LitElement {
:host(:not([lastItem])) .content { :host(:not([lastItem])) .content {
padding-bottom: 16px; padding-bottom: 16px;
} }
:host([label]) .content {
margin-top: 0;
padding-top: 6px;
}
`, `,
buttonLinkStyle, buttonLinkStyle,
]; ];

View File

@ -19,7 +19,6 @@ import {
mdiCheckCircleOutline, mdiCheckCircleOutline,
mdiCircle, mdiCircle,
mdiCircleOutline, mdiCircleOutline,
mdiClockOutline,
mdiPauseCircleOutline, mdiPauseCircleOutline,
mdiRecordCircleOutline, mdiRecordCircleOutline,
mdiStopCircleOutline, mdiStopCircleOutline,
@ -93,7 +92,7 @@ export class HaAutomationTracer extends LitElement {
} }
entries.push(html` entries.push(html`
<ha-timeline .icon=${mdiClockOutline}> <ha-timeline label>
${relativeTime(lastReportedTime, this.hass.localize, { ${relativeTime(lastReportedTime, this.hass.localize, {
compareTime: nextItemTimestamp, compareTime: nextItemTimestamp,
includeTense: false, includeTense: false,