From ed5bb517266c80904c44bf44a335f1003f5aa277 Mon Sep 17 00:00:00 2001 From: Kim <1877318+kimsible@users.noreply.github.com> Date: Thu, 23 Jul 2020 15:09:15 +0200 Subject: [PATCH] Improve navigation sub-menu and tabs effects (#2971) * Improve nav border and colors on active and non-active * Remove margin-top effect on active nav * Use opacity / bold instead of color change on nav * Remove dropdown items label in sub-menu and add a class active * Position sub-menu to fixed * Autoclose dropdown sub-menu only on outside click * Remove open dropdown on hover in sub-menu * Show reusable h1 for dropdown item in sub-menu * Put reusable sub-menu h1 styles to mixins * Add icons to sub-menu dropdown-item h1 * Make all the sub-menu accessible with focus Co-authored-by: kimsible --- client/src/app/+admin/admin.component.scss | 5 +++ .../followers-list.component.html | 5 +++ .../following-list.component.html | 5 +++ .../video-redundancies-list.component.html | 5 +++ .../abuse-list/abuse-list.component.html | 5 +++ .../video-block-list.component.html | 5 +++ .../app/+admin/plugins/plugins.component.html | 2 - .../app/+admin/plugins/plugins.component.scss | 5 --- .../app/+admin/system/system.component.html | 2 - .../my-account-video-channels.component.html | 6 ++- .../my-account-history.component.html | 6 ++- .../my-account-ownership.component.html | 6 ++- .../my-account-subscriptions.component.html | 6 ++- .../my-account-video-imports.component.html | 6 ++- .../my-account-video-playlists.component.html | 8 +++- .../my-account-video-playlists.component.scss | 4 -- .../my-account-videos.component.html | 9 ++-- .../my-account-videos.component.scss | 6 --- .../app/+my-account/my-account.component.scss | 5 +++ .../+video-edit/video-add.component.scss | 19 ++++++--- .../misc/top-menu-dropdown.component.html | 16 ++++---- .../misc/top-menu-dropdown.component.scss | 6 +++ .../misc/top-menu-dropdown.component.ts | 23 ----------- .../account-blocklist.component.html | 5 +++ .../server-blocklist.component.html | 5 +++ client/src/sass/application.scss | 31 ++++++++------ client/src/sass/bootstrap.scss | 41 +++++++++---------- client/src/sass/include/_mixins.scss | 20 +++++++++ client/src/sass/include/_variables.scss | 1 + 29 files changed, 170 insertions(+), 98 deletions(-) diff --git a/client/src/app/+admin/admin.component.scss b/client/src/app/+admin/admin.component.scss index ef8965c3f..61a2744ba 100644 --- a/client/src/app/+admin/admin.component.scss +++ b/client/src/app/+admin/admin.component.scss @@ -1,3 +1,8 @@ +@import '_variables'; +@import '_mixins'; + my-top-menu-dropdown { flex-grow: 1; } + +@include sub-menu-h1; diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.html b/client/src/app/+admin/follows/followers-list/followers-list.component.html index ce603459e..f50828bb9 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.html +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.html @@ -1,3 +1,8 @@ +

+ + Instances following you +

+ + + Instances you follow + + + + Videos redundancies + +
diff --git a/client/src/app/+admin/moderation/abuse-list/abuse-list.component.html b/client/src/app/+admin/moderation/abuse-list/abuse-list.component.html index 99502304d..48b31b99c 100644 --- a/client/src/app/+admin/moderation/abuse-list/abuse-list.component.html +++ b/client/src/app/+admin/moderation/abuse-list/abuse-list.component.html @@ -1,3 +1,8 @@ +

+ + Reports +

+ + + Video blocks + + -

Plugins/Themes

-
Installed diff --git a/client/src/app/+admin/plugins/plugins.component.scss b/client/src/app/+admin/plugins/plugins.component.scss index 04ca8126a..ce9825f53 100644 --- a/client/src/app/+admin/plugins/plugins.component.scss +++ b/client/src/app/+admin/plugins/plugins.component.scss @@ -1,11 +1,6 @@ @import '_variables'; @import '_mixins'; -.form-sub-title { - flex-grow: 0; - margin-right: 30px; -} - @media screen and (max-width: $small-view) { ::ng-deep .plugins .plugin .first-row { flex-wrap: wrap; diff --git a/client/src/app/+admin/system/system.component.html b/client/src/app/+admin/system/system.component.html index 4f9521c0c..5385887b7 100644 --- a/client/src/app/+admin/system/system.component.html +++ b/client/src/app/+admin/system/system.component.html @@ -1,6 +1,4 @@
-

System

-
Jobs diff --git a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html index b2e8210d3..e8d44a45e 100644 --- a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html @@ -1,4 +1,8 @@ -

My channels

+

+ + My channels +

+
diff --git a/client/src/app/+my-account/my-account-history/my-account-history.component.html b/client/src/app/+my-account/my-account-history/my-account-history.component.html index cfa5ca636..cff46a41d 100644 --- a/client/src/app/+my-account/my-account-history/my-account-history.component.html +++ b/client/src/app/+my-account/my-account-history/my-account-history.component.html @@ -1,4 +1,8 @@ -

History

+

+ + My history +

+
diff --git a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.html b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.html index 090ec7b44..be5d41f3b 100644 --- a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.html +++ b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.html @@ -1,4 +1,8 @@ -

Ownership changes

+

+ + My ownership changes +

+ Subscriptions +

+ + My subscriptions +

+
You don't have any subscriptions yet.
diff --git a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html index 4caa076a3..98a2039cc 100644 --- a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html +++ b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html @@ -1,4 +1,8 @@ -

Imports

+

+ + My imports +

+ -

Playlists {{ pagination.totalItems }}

+

+ + My playlists {{ pagination.totalItems }} +

+ +
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.scss b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.scss index 41e7851fd..4381d74b0 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.scss +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.scss @@ -41,10 +41,6 @@ input[type=text] { @include peertube-input-text(300px); } - - h1 { - font-size: 1.5rem; - } } @media screen and (max-width: $small-view) { diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html index cb149b607..6d098b507 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html @@ -1,9 +1,10 @@ +

+ + My videos {{ pagination.totalItems }} +

+
-

Videos {{ pagination.totalItems }}

- - -
my-top-menu-dropdown:nth-child(1) { flex-grow: 1; } + + @include sub-menu-h1; } diff --git a/client/src/app/+videos/+video-edit/video-add.component.scss b/client/src/app/+videos/+video-edit/video-add.component.scss index 0ad57d897..b9fef9fce 100644 --- a/client/src/app/+videos/+video-edit/video-add.component.scss +++ b/client/src/app/+videos/+video-edit/video-add.component.scss @@ -30,16 +30,25 @@ $nav-link-height: 40px; padding: 0 30px !important; font-size: 15px; + border: $border-width $border-type transparent; + + span { + border-bottom: 2px solid transparent; + } + &.active { - border: $border-width $border-type $border-color; - border-bottom: none; + border-color: $border-color; + border-bottom-color: transparent; background-color: pvar(--submenuColor) !important; span { - border-bottom: 2px solid pvar(--mainColor); - font-weight: $font-bold; + border-bottom-color: pvar(--mainColor); } } + + &:hover:not(.active) { + border-color: transparent; + } } } @@ -71,7 +80,7 @@ $nav-link-height: 40px; /* Hide active tab style to not have a moving tab effect */ a.nav-link.active { - border: none; + border-color: transparent; background-color: pvar(--mainBackgroundColor) !important; } } diff --git a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html index aeaceb662..c737b40c7 100644 --- a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html +++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html @@ -4,26 +4,28 @@
{{ menuEntry.label }}
+ #dropdown="ngbDropdown" autoClose="outside"> + (click)="openModal(id)" (keydown.enter)="openModal(id)" + role="button" class="title-page title-page-settings"> {{ menuEntry.label }} - - {{ suffixLabels[menuEntry.label] }} {{ menuEntry.label }} - - {{ suffixLabels[menuEntry.label] }}
- + {{ menuChild.label }} diff --git a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.scss b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.scss index 84dd7dce3..655c38489 100644 --- a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.scss +++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.scss @@ -1,6 +1,12 @@ @import '_variables'; @import '_mixins'; +:host { + display: block; + height: $sub-menu-height; + margin-bottom: $sub-menu-margin-bottom; +} + .parent-entry { span[role=button] { cursor: pointer; diff --git a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts index 5909db0b5..66f8f7e55 100644 --- a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts +++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts @@ -33,7 +33,6 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { isModalOpened = false currentMenuEntryIndex: number - private openedOnHover = false private routeSub: Subscription constructor ( @@ -68,32 +67,10 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { if (this.routeSub) this.routeSub.unsubscribe() } - openDropdownOnHover (dropdown: NgbDropdown) { - this.openedOnHover = true - dropdown.open() - - // Menu was closed - dropdown.openChange - .pipe(take(1)) - .subscribe(() => this.openedOnHover = false) - } - dropdownAnchorClicked (dropdown: NgbDropdown) { - if (this.openedOnHover) { - this.openedOnHover = false - return - } - return dropdown.toggle() } - closeDropdownIfHovered (dropdown: NgbDropdown) { - if (this.openedOnHover === false) return - - dropdown.close() - this.openedOnHover = false - } - openModal (index: number) { this.currentMenuEntryIndex = index this.isModalOpened = true diff --git a/client/src/app/shared/shared-moderation/account-blocklist.component.html b/client/src/app/shared/shared-moderation/account-blocklist.component.html index 486785f35..df98cf84e 100644 --- a/client/src/app/shared/shared-moderation/account-blocklist.component.html +++ b/client/src/app/shared/shared-moderation/account-blocklist.component.html @@ -1,3 +1,8 @@ +

+ + Muted accounts +

+ + + Muted servers + +