From 8c27825a1d9014f2480641f22481c69272a4c399 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 20 Apr 2020 21:08:22 +0200 Subject: [PATCH] Using margin instead of padding for the browse view --- src/app/app.module.ts | 4 +- src/app/browse/browse.component.scss | 12 +-- .../metadata-edit.component.html | 2 +- src/app/show-grid/show-grid.component.html | 11 +++ src/app/show-grid/show-grid.component.scss | 83 +++++++++++++++++++ src/app/show-grid/show-grid.component.ts | 20 +++++ 6 files changed, 124 insertions(+), 8 deletions(-) create mode 100644 src/app/show-grid/show-grid.component.html create mode 100644 src/app/show-grid/show-grid.component.scss create mode 100644 src/app/show-grid/show-grid.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 814a8add..813b06b8 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -39,6 +39,7 @@ import { MetadataEditComponent } from './metadata-edit/metadata-edit.component'; import {MatChipsModule} from "@angular/material/chips"; import {MatAutocompleteModule} from "@angular/material/autocomplete"; import {MatExpansionModule} from "@angular/material/expansion"; +import { ShowGridComponent } from './show-grid/show-grid.component'; @NgModule({ @@ -57,7 +58,8 @@ import {MatExpansionModule} from "@angular/material/expansion"; FallbackDirective, TrailerDialogComponent, CollectionsListComponent, - MetadataEditComponent + MetadataEditComponent, + ShowGridComponent ], imports: [ BrowserModule, diff --git a/src/app/browse/browse.component.scss b/src/app/browse/browse.component.scss index be2c607c..34366568 100644 --- a/src/app/browse/browse.component.scss +++ b/src/app/browse/browse.component.scss @@ -20,24 +20,24 @@ button .show { - width: 33%; + width: 28%; min-width: 120px; - max-width: 200px; + max-width: 168px; list-style: none; - padding: .5em; + margin: .5em; text-decoration: none; color: inherit; outline: none; @include media-breakpoint-up(sm) { - width: 25%; + width: 20%; } @include media-breakpoint-up(md) { - width: 20%; - padding: 1em; + width: 18%; + margin: 1em; } @include media-breakpoint-up(lg) diff --git a/src/app/metadata-edit/metadata-edit.component.html b/src/app/metadata-edit/metadata-edit.component.html index b0d345d1..d3c3eebd 100644 --- a/src/app/metadata-edit/metadata-edit.component.html +++ b/src/app/metadata-edit/metadata-edit.component.html @@ -84,7 +84,7 @@ Identify show Search on metadata providers - + diff --git a/src/app/show-grid/show-grid.component.html b/src/app/show-grid/show-grid.component.html new file mode 100644 index 00000000..23602af8 --- /dev/null +++ b/src/app/show-grid/show-grid.component.html @@ -0,0 +1,11 @@ +
+ + +
+

{{show.title}}

+

{{show.startYear}} - {{show.endYear}}

+

{{show.startYear}}

+

{{show.overview}}

+
+
+
diff --git a/src/app/show-grid/show-grid.component.scss b/src/app/show-grid/show-grid.component.scss new file mode 100644 index 00000000..f61d9d61 --- /dev/null +++ b/src/app/show-grid/show-grid.component.scss @@ -0,0 +1,83 @@ +@import "~bootstrap/scss/functions"; +@import "~bootstrap/scss/variables"; +@import "~bootstrap/scss/mixins/breakpoints"; + +button +{ + outline: none; +} + +.arrow +{ + font-size: 12px; +} + +.container-fluid +{ + display: flex; + flex-wrap: wrap; +} + +.show +{ + width: 100%; + min-width: 300px; + list-style: none; + margin: .5em; + text-decoration: none; + color: inherit; + outline: none; + + @include media-breakpoint-up(lg) + { + width: 50%; + } + + @include media-breakpoint-up(xl) + { + width: 33%; + } + + &:focus, &:hover + { + > div + { + outline: solid var(--accentColor); + } + + > .title + { + text-decoration: underline; + } + } + + > div + { + width: 100%; + height: 0; + padding-top: 147.0588%; + background-size: cover; + background-color: #333333; + } + + > p + { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + text-align: center; + margin-bottom: 0px; + opacity: 1; + + &.date + { + opacity: 0.8; + font-size: 0.8em; + } + } + + &:host-context(.hoverEnabled) &:hover + { + cursor: pointer; + } +} diff --git a/src/app/show-grid/show-grid.component.ts b/src/app/show-grid/show-grid.component.ts new file mode 100644 index 00000000..c73e9f92 --- /dev/null +++ b/src/app/show-grid/show-grid.component.ts @@ -0,0 +1,20 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {Show} from "../../models/show"; +import {DomSanitizer} from "@angular/platform-browser"; + +@Component({ + selector: 'app-show-grid', + templateUrl: './show-grid.component.html', + styleUrls: ['./show-grid.component.scss'] +}) +export class ShowGridComponent +{ + @Input() shows: Show[] + + constructor(private sanitizer: DomSanitizer) { } + + getThumb(slug: string) + { + return this.sanitizer.bypassSecurityTrustStyle("url(/poster/" + slug + ")"); + } +}