From c38db1d1e1d6ac40458d8139195b7af319fe4d1e Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Mon, 5 Aug 2019 20:11:29 -0400 Subject: [PATCH] created a floating header --- .../user-profile/user-profile.component.html | 164 ++++++++++-------- .../user-profile/user-profile.component.scss | 38 ++++ .../user-profile/user-profile.component.ts | 8 + 3 files changed, 135 insertions(+), 75 deletions(-) diff --git a/src/app/components/stream/user-profile/user-profile.component.html b/src/app/components/stream/user-profile/user-profile.component.html index fa544720..3b4878f5 100644 --- a/src/app/components/stream/user-profile/user-profile.component.html +++ b/src/app/components/stream/user-profile/user-profile.component.html @@ -1,90 +1,104 @@ -
- - -
- {{displayedAccount | accountEmoji }} has moved to @{{displayedAccount.moved.acct }} -
- -
-
- - header - -

-

@{{displayedAccount.acct}}

- - -
-
follows you
-
blocked
-
blocks you
-
domain blocked
-
muted
-
notifications muted -
+
+
+
+
+ FLOATING HEADER
-
-
-
- - + + +
+ {{displayedAccount | accountEmoji }} has moved to @{{displayedAccount.moved.acct }}
-
-
-
+ +
+
+ + header + +

+

@{{displayedAccount.acct}}

+ + -
- {{ field.name }} +
+
follows you
+
blocked
+
blocks you
+
domain blocked
+
muted
+
notifications + muted +
-
-
- no toots found +
+
+ + +
+
+
+
+
+
+ {{ field.name }} +
+
-
- - +
+
+ no toots found +
+ +
+ + +
+ +
+ + +
+ + +
- -
- - -
- - -
\ No newline at end of file diff --git a/src/app/components/stream/user-profile/user-profile.component.scss b/src/app/components/stream/user-profile/user-profile.component.scss index 5be8dbc0..85a95139 100644 --- a/src/app/components/stream/user-profile/user-profile.component.scss +++ b/src/app/components/stream/user-profile/user-profile.component.scss @@ -5,11 +5,49 @@ $validated-font-color: #4fde23; $validated-background: #164109; $header-height: 160px; +.outer-profile { + height: calc(100%); + overflow: hidden; + position: relative; +} + .profile { // overflow: auto; height: calc(100%); overflow: auto; + &__floating-header { + transition: all .2s; + transition-timing-function: ease-in; + + height: 60px; + width: calc(100% - 7px); + background-position: center center; + background-repeat: no-repeat; + background-size: cover; + + position: absolute; + top: -60px; + z-index: 100; + + border-bottom: 1px solid #222736; + + // opacity: 0; + + &__inner { + overflow: auto; + height: 60px; + background-color: rgba(0, 0, 0, .45); + } + + &__activated { + // opacity: 1; + transition: all .25s; + transition-timing-function: ease-out; + top: 0px; + } + } + &__moved { padding: 5px; text-align: center; diff --git a/src/app/components/stream/user-profile/user-profile.component.ts b/src/app/components/stream/user-profile/user-profile.component.ts index 3e5e76a2..8403b9c0 100644 --- a/src/app/components/stream/user-profile/user-profile.component.ts +++ b/src/app/components/stream/user-profile/user-profile.component.ts @@ -34,6 +34,7 @@ export class UserProfileComponent implements OnInit { isLoading: boolean; loadingRelationShip = false; + showFloatingHeader = false; private maxReached = false; private maxId: string; @@ -205,6 +206,7 @@ export class UserProfileComponent implements OnInit { } refresh(): any { + this.showFloatingHeader = false; this.load(this.lastAccountName); } @@ -255,6 +257,12 @@ export class UserProfileComponent implements OnInit { var element = this.statustream.nativeElement as HTMLElement; const atBottom = element.scrollHeight <= element.clientHeight + element.scrollTop + 1000; + if(element.scrollTop > 150){ + this.showFloatingHeader = true; + } else { + this.showFloatingHeader = false; + } + if (atBottom) { this.scrolledToBottom(); }