From f0c4ed45903cd0f33d710a60f457eafc0114f24a Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 2 Aug 2020 18:03:29 -0400 Subject: [PATCH] Unified file card now supports small and medium size Duration styling/position updated and added download date time --- .../unified-file-card.component.html | 17 +- .../unified-file-card.component.scss | 176 +++++++++++------- .../unified-file-card.component.ts | 4 + 3 files changed, 121 insertions(+), 76 deletions(-) diff --git a/src/app/components/unified-file-card/unified-file-card.component.html b/src/app/components/unified-file-card/unified-file-card.component.html index 2f59220..ef73341 100644 --- a/src/app/components/unified-file-card/unified-file-card.component.html +++ b/src/app/components/unified-file-card/unified-file-card.component.html @@ -1,7 +1,5 @@
-
- Length: {{file_length}} -
+
{{file_obj.registered | date:'shortDate'}}
@@ -13,13 +11,20 @@ delete_foreverDelete forever - + +
- Thumbnail +
+ Thumbnail +
+ {{file_length}} +
+
+
- {{file_title}} + {{file_obj.title}}
diff --git a/src/app/components/unified-file-card/unified-file-card.component.scss b/src/app/components/unified-file-card/unified-file-card.component.scss index 65cd869..b26745b 100644 --- a/src/app/components/unified-file-card/unified-file-card.component.scss +++ b/src/app/components/unified-file-card/unified-file-card.component.scss @@ -1,76 +1,112 @@ -.example-card { +.file-mat-card { width: 200px; height: 200px; padding: 0px; cursor: pointer; - } +} + +.small-mat-card { + width: 150px; + height: 150px; + padding: 0px; + cursor: pointer; +} + +.menuButton { + right: 0px; + top: -1px; + position: absolute; + z-index: 999; - .menuButton { - right: 0px; - top: -1px; - position: absolute; - z-index: 999; +} + +/* Coerce the icon container away from display:inline */ +.mat-icon-button .mat-button-wrapper { + display: flex; + justify-content: center; +} + +.image { + width: 200px; + height: 112.5px; + object-fit: cover; +} + +.image-small { + width: 150px; + height: 84.5px; + object-fit: cover; +} + +.example-full-width-height { + width: 100%; + height: 100% +} + +.centered { + margin: 0 auto; + top: 50%; + left: 50%; +} + +.img-div { + max-height: 80px; + padding: 0px; + margin: 32px 0px 0px -5px; + width: calc(100% + 5px + 5px); +} + +.max-two-lines { + display: -webkit-box; + display: -moz-box; + max-height: 2.4em; + line-height: 1.2em; + overflow: hidden; + text-overflow: ellipsis; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + bottom: 5px; + position: absolute; +} + +.max-one-line { + display: -webkit-box; + display: -moz-box; + max-height: 1.2em; + line-height: 1.2em; + overflow: hidden; + text-overflow: ellipsis; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + bottom: 5px; + position: absolute; +} + +.duration-time { + position: absolute; + bottom: 5px; + right: 5px; + z-index: 99999; + background: rgba(255,255,255,0.6); + padding-left: 5px; + padding-right: 5px; +} + +.download-time { + position: absolute; + top: 5px; + left: 5px; + z-index: 99999; +} + +@media (max-width: 576px){ + + // .example-card { + // width: 175px !important; + // } + + // .image { + // width: 175px; + // } - } - - /* Coerce the icon container away from display:inline */ - .mat-icon-button .mat-button-wrapper { - display: flex; - justify-content: center; - } - - .image { - width: 200px; - height: 112.5px; - object-fit: cover; - } - - .example-full-width-height { - width: 100%; - height: 100% - } - - .centered { - margin: 0 auto; - top: 50%; - left: 50%; - } - - .img-div { - max-height: 80px; - padding: 0px; - margin: 32px 0px 0px -5px; - width: calc(100% + 5px + 5px); - } - - .max-two-lines { - display: -webkit-box; - display: -moz-box; - max-height: 2.4em; - line-height: 1.2em; - overflow: hidden; - text-overflow: ellipsis; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - bottom: 5px; - position: absolute; - } - - .duration-time { - position: absolute; - left: 5px; - top: 5px; - z-index: 99999; - } - - @media (max-width: 576px){ - - .example-card { - width: 175px !important; - } - - .image { - width: 175px; - } - - } +} diff --git a/src/app/components/unified-file-card/unified-file-card.component.ts b/src/app/components/unified-file-card/unified-file-card.component.ts index 1a99894..ca8e27e 100644 --- a/src/app/components/unified-file-card/unified-file-card.component.ts +++ b/src/app/components/unified-file-card/unified-file-card.component.ts @@ -17,6 +17,7 @@ export class UnifiedFileCardComponent implements OnInit { use_youtubedl_archive = false; @Input() file_obj = null; + @Input() card_size = 'medium'; @Output() goToFile = new EventEmitter(); @Output() goToSubscription = new EventEmitter(); @@ -59,6 +60,9 @@ export class UnifiedFileCardComponent implements OnInit { } function fancyTimeFormat(time) { + if (typeof time === 'string') { + return time; + } // Hours, minutes and seconds const hrs = ~~(time / 3600); const mins = ~~((time % 3600) / 60);