Refactor css.

This commit is contained in:
Dermot Duffy
2021-09-06 20:43:13 -07:00
parent c1f8558406
commit 90807be6f7
2 changed files with 17 additions and 38 deletions
+13 -19
View File
@@ -512,7 +512,7 @@ export class FrigateCard extends LitElement {
icon: string, icon: string,
message: string | TemplateResult | null = null, message: string | TemplateResult | null = null,
): TemplateResult { ): TemplateResult {
return html` <div class="frigate-card-attention"> return html` <div class="frigate-card-contents attention">
<span> <span>
<ha-icon icon="${icon}"> </ha-icon> <ha-icon icon="${icon}"> </ha-icon>
${message ? html`&nbsp;${message}` : ''} ${message ? html`&nbsp;${message}` : ''}
@@ -737,12 +737,12 @@ export class FrigateCard extends LitElement {
'frigate-media-controls': true, 'frigate-media-controls': true,
previous: previous, previous: previous,
next: !previous, next: !previous,
thumbnails: ( thumbnails:
!this.config.controls?.nextprev || !this.config.controls?.nextprev ||
this.config.controls?.nextprev === "thumbnails"), this.config.controls?.nextprev === 'thumbnails',
chevrons: this.config.controls?.nextprev === "chevrons", chevrons: this.config.controls?.nextprev === 'chevrons',
button: this.config.controls?.nextprev === "chevrons", button: this.config.controls?.nextprev === 'chevrons',
} };
const clickChangeView = () => { const clickChangeView = () => {
this._view = new View({ this._view = new View({
@@ -751,7 +751,7 @@ export class FrigateCard extends LitElement {
childIndex: targetChildIndex, childIndex: targetChildIndex,
previous: this._view, previous: this._view,
}); });
} };
if (this.config.controls?.nextprev == 'chevrons') { if (this.config.controls?.nextprev == 'chevrons') {
return html` <ha-icon-button return html` <ha-icon-button
@@ -829,7 +829,7 @@ export class FrigateCard extends LitElement {
? html`<ha-hls-player ? html`<ha-hls-player
.hass=${this._hass} .hass=${this._hass}
.url=${resolvedMedia.url} .url=${resolvedMedia.url}
class="frigate-card-viewer" class="frigate-card-contents"
title="${mediaToRender.title}" title="${mediaToRender.title}"
muted muted
controls controls
@@ -839,7 +839,7 @@ export class FrigateCard extends LitElement {
> >
</ha-hls-player>` </ha-hls-player>`
: html`<video : html`<video
class="frigate-card-viewer" class="frigate-card-contents"
title="${mediaToRender.title}" title="${mediaToRender.title}"
muted muted
controls controls
@@ -856,7 +856,7 @@ export class FrigateCard extends LitElement {
</video>` </video>`
: html`<img : html`<img
src=${resolvedMedia.url} src=${resolvedMedia.url}
class="frigate-card-viewer" class="frigate-card-contents"
title="${mediaToRender.title}" title="${mediaToRender.title}"
@click=${() => { @click=${() => {
// Get clips potentially related to this snapshot. // Get clips potentially related to this snapshot.
@@ -1000,18 +1000,12 @@ export class FrigateCard extends LitElement {
${this.config.menu_mode != 'below' ? this._renderMenu() : ''} ${this.config.menu_mode != 'below' ? this._renderMenu() : ''}
<div class="frigate-card-contents"> <div class="frigate-card-contents">
${this._view.is('clips') || this._view.is('snapshots') ${this._view.is('clips') || this._view.is('snapshots')
? html`<div class="frigate-card-gallery"> ? until(this._renderEvents(), this._renderProgressIndicator())
${until(this._renderEvents(), this._renderProgressIndicator())}
</div>`
: ``} : ``}
${this._view.is('clip') || this._view.is('snapshot') ${this._view.is('clip') || this._view.is('snapshot')
? html`<div class="frigate-card-viewer"> ? until(this._renderViewer(), this._renderProgressIndicator())
${until(this._renderViewer(), this._renderProgressIndicator())}
</div>`
: ``}
${this._view.is('live')
? html`<div class="frigate-card-viewer">${this._renderLiveViewer()}</div>`
: ``} : ``}
${this._view.is('live') ? this._renderLiveViewer() : ``}
</div> </div>
${this.config.menu_mode == 'below' ? this._renderMenu() : ''} ${this.config.menu_mode == 'below' ? this._renderMenu() : ''}
</ha-card>`; </ha-card>`;
+4 -19
View File
@@ -4,41 +4,26 @@
.frigate-card-contents { .frigate-card-contents {
width: 100%; width: 100%;
max-height: 277px; /* Max Lovelace 16/9 video height */
height: 100%; height: 100%;
aspect-ratio: 16 / 9; aspect-ratio: 16 / 9;
overflow: auto; overflow: auto;
}
.frigate-card-viewer {
width: 100%;
height: 100%;
aspect-ratio: 16 / 9;
}
.frigate-card-gallery {
overflow: auto;
-ms-overflow-style: none; /* Hide scrollbar: IE and Edge */ -ms-overflow-style: none; /* Hide scrollbar: IE and Edge */
scrollbar-width: none; /* Hide scrollbar: Firefox */ scrollbar-width: none; /* Hide scrollbar: Firefox */
height: 100%;
aspect-ratio: 16 / 9;
} }
/* Hide scrollbar for Chrome, Safari and Opera */ /* Hide scrollbar for Chrome, Safari and Opera */
.frigate-card-gallery::-webkit-scrollbar { .frigate-card-contents::-webkit-scrollbar {
display: none; display: none;
} }
.frigate-card-attention { .frigate-card-contents.attention {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 0% 5% 0% 5%;
height: 100%; box-sizing: border-box;
padding: 5%;
} }
.frigate-card-image-list { .frigate-card-image-list {