From 0f7407d926cf7774f8f730dba08327569c11680c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 1 Apr 2021 11:10:27 +0200 Subject: Refactor video miniature Less dirty code, better responsive Prepare for some regressions Increase default miniature size --- .../video-miniature.component.scss | 308 +++++++++++---------- 1 file changed, 155 insertions(+), 153 deletions(-) (limited to 'client/src/app/shared/shared-video-miniature/video-miniature.component.scss') diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.scss b/client/src/app/shared/shared-video-miniature/video-miniature.component.scss index a9628c696..39d6e97c9 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.scss +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.scss @@ -3,204 +3,206 @@ @import '_miniature'; $more-button-width: 40px; -$more-margin-right: 15px; -.video-miniature { - display: inline-flex; - flex-direction: column; - padding-bottom: $video-miniature-margin-bottom; - vertical-align: top; +.video-miniature-name { + @include miniature-name; +} - .video-bottom { - display: flex; +.video-miniature-information { + width: calc(100% - #{$more-button-width}); +} - .video-miniature-information { - width: $video-miniature-width - $more-button-width - $more-margin-right; - line-height: normal; +.avatar { + margin: 10px 10px 0 0; - .avatar { - margin: 10px 10px 0 0; + img:not(.channel) { + @include avatar(40px); + } - img:not(.channel) { - @include avatar(40px); - } + img.channel { + @include channel-avatar(40px); + } +} - img.channel { - @include channel-avatar(40px); - } - } +.video-miniature-created-at-views { + font-size: 13px; +} - .video-miniature-name { - @include miniature-name; +.video-miniature-account, +.video-miniature-channel { + @include disable-default-a-behaviour; + @include ellipsis; - word-wrap: break-word; - width: calc(100% - #{$more-button-width}); - } + display: block; + font-size: 13px; + color: pvar(--greyForegroundColor); - .video-miniature-meta { - width: calc(100% + #{$more-button-width}); - overflow: hidden; - } + &:hover { + color: $grey-foreground-hover-color; + } +} - .video-miniature-created-at-views { - display: block; - font-size: 13px; - } +.video-info-privacy, +.video-info-blocked .blocked-label, +.video-info-nsfw { + font-weight: $font-semibold; +} - .video-miniature-account, - .video-miniature-channel { - @include disable-default-a-behaviour; - @include ellipsis; +.video-info-blocked { + color: red; - display: block; - font-size: 13px; - color: pvar(--greyForegroundColor); + .blocked-reason::before { + content: ' - '; + } +} - &:hover { - color: $grey-foreground-hover-color; - } - } +.video-info-nsfw { + color: red; +} - .video-info-privacy, - .video-info-blocked .blocked-label, - .video-info-nsfw { - font-weight: $font-semibold; - } +.video-actions { + width: $more-button-width; + height: 30px; - .video-info-blocked { - color: red; + ::ng-deep .dropdown-root:not(.show) { + opacity: 0; + } - .blocked-reason::before { - content: ' - '; - } - } + ::ng-deep .playlist-dropdown.show + my-action-dropdown .dropdown-root { + opacity: 1; + } - .video-info-nsfw { - color: red; - } - } + ::ng-deep .more-icon { + opacity: .6; - .video-actions { - margin-top: 3px; - width: $more-button-width; - height: 30px; + &:hover { + opacity: 1; + } + } +} - ::ng-deep .dropdown-root:not(.show) { - opacity: 0; - } +.video-miniature { + &:hover ::ng-deep .video-thumbnail-actions-overlay, + &:hover .video-actions ::ng-deep .dropdown-root { + opacity: 1 !important; + } +} - ::ng-deep .playlist-dropdown.show + my-action-dropdown .dropdown-root { - opacity: 1; - } +// Grid mode +// Takes all the width on mobile +.video-miniature:not(.display-as-row) { + display: flex; + flex-direction: column; + padding-bottom: $video-miniature-margin-bottom; + width: 100%; - ::ng-deep .more-icon { - opacity: .6; + my-video-thumbnail { + @include large-screen-ratio($selector: '::ng-deep .video-thumbnail'); + } - &:hover { - opacity: 1; - } - } - } + .video-bottom { + display: flex; + width: 100%; + } - @media screen and (max-width: $small-view) { - .video-miniature-information { - margin: 0 10px; - } - .video-actions { - margin: 0; - top: -3px; + .video-miniature-name { + margin-top: 10px; + margin-bottom: 5px; + } - ::ng-deep .dropdown-root { - opacity: 1 !important; - } - } - } + .video-miniature-created-at-views { + display: block; } - &:hover ::ng-deep .video-thumbnail .video-thumbnail-actions-overlay, - &:hover .video-bottom .video-actions ::ng-deep .dropdown-root { - opacity: 1; + .video-actions { + margin-top: 3px; } - &.fit-width { + @media screen and (max-width: $small-view) { width: 100%; + margin-bottom: 25px; + + .video-miniature-information { + margin: 0 10px; + + width: 100%; + text-align: left; + } - .video-bottom { - width: 100% !important; + .video-actions { + margin: 0; + top: -3px; - .video-miniature-information { - width: calc(100% - #{$more-button-width}) !important; + ::ng-deep .dropdown-root { + opacity: 1 !important; } } - my-video-thumbnail { - @include large-screen-ratio($selector: '::ng-deep .video-thumbnail'); + ::ng-deep .video-thumbnail { + border-radius: 0; } } +} + +.video-miniature.display-as-row { + --rowThumbnailWidth: #{$video-thumbnail-width}; + --rowThumbnailHeight: #{$video-thumbnail-height}; + + display: flex; + flex-direction: row; - &.display-as-row { - flex-direction: row; - padding-bottom: 0; - height: auto; + .video-bottom { display: flex; - flex-grow: 1; + } - my-video-thumbnail { - margin-right: 10px; - } + // We don't display avatar in row mode + .avatar { + display: none; + } - .video-bottom { - .video-miniature-information { - @media screen and (min-width: $small-view) { - width: auto; - min-width: 500px; - } - - .video-miniature-name { - @include ellipsis-multiline(1.3em, 2); - - margin-top: 2px; - margin-bottom: 5px; - } - - .video-miniature-created-at-views, - .video-miniature-account, - .video-miniature-channel { - font-size: 95%; - width: fit-content; - } - - .video-miniature-created-at-views + .video-miniature-channel { - margin-top: 5px; - } - - .video-info-privacy { - margin-top: 5px; - } - - .video-info-blocked { - margin-top: 3px; - } - } + my-video-thumbnail { + min-width: var(--rowThumbnailWidth); + max-width: var(--rowThumbnailWidth); + height: var(--rowThumbnailHeight); + margin-right: 10px; + } - .video-actions { - margin: 0; - top: -3px; - } - } + .video-miniature-name { + @include ellipsis-multiline(1.3em, 2); + } + + .video-miniature-created-at-views, + .video-miniature-account, + .video-miniature-channel { + font-size: 14px; + } - @media screen and (max-width: $small-view) { - flex-direction: column; - height: auto; + .video-actions { + margin-top: -3px; + } +} - my-video-thumbnail { - margin-right: 0; - } +@include on-small-main-col { + .video-miniature.display-as-row { + --rowThumbnailWidth: #{$video-thumbnail-medium-width}; + --rowThumbnailHeight: #{$video-thumbnail-medium-height}; + } +} - .video-miniature-information { - min-width: initial; - } +@include on-mobile-main-col { + .video-miniature.display-as-row { + --rowThumbnailWidth: #{$video-thumbnail-small-width}; + --rowThumbnailHeight: #{$video-thumbnail-small-height}; + + .video-miniature-name { + font-size: 14px; + } + + .video-miniature-created-at-views, + .video-miniature-account, + .video-miniature-channel { + font-size: 12px; } } } -- cgit v1.2.3