about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/followers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-03-08 20:34:31 +0100
committerThibG <thib@sitedethib.com>2019-03-11 14:19:16 +0100
commit4849eb8e7f58e9f1da73422fa71dbb07d6ff1db5 (patch)
tree2bb244097081e3eae2c4c7e7684476a88b05f13c /app/javascript/flavours/glitch/features/followers
parent45e4c90a23ccd6ccbed389d5c1b62f830d2c3757 (diff)
Make clicking on the account and status column headers scroll to top
Diffstat (limited to 'app/javascript/flavours/glitch/features/followers')
-rw-r--r--app/javascript/flavours/glitch/features/followers/index.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/followers/index.js b/app/javascript/flavours/glitch/features/followers/index.js
index 124004cb6..6bb9f60fd 100644
--- a/app/javascript/flavours/glitch/features/followers/index.js
+++ b/app/javascript/flavours/glitch/features/followers/index.js
@@ -43,6 +43,10 @@ export default class Followers extends ImmutablePureComponent {
     }
   }
 
+  handleHeaderClick = () => {
+    this.column.scrollTop();
+  }
+
   handleScroll = (e) => {
     const { scrollTop, scrollHeight, clientHeight } = e.target;
 
@@ -61,6 +65,10 @@ export default class Followers extends ImmutablePureComponent {
     return !(location.state && location.state.mastodonModalOpen);
   }
 
+  setRef = c => {
+    this.column = c;
+  }
+
   render () {
     const { accountIds, hasMore } = this.props;
 
@@ -79,8 +87,8 @@ export default class Followers extends ImmutablePureComponent {
     }
 
     return (
-      <Column>
-        <ProfileColumnHeader />
+      <Column ref={this.setRef}>
+        <ProfileColumnHeader onClick={this.handleHeaderClick} />
 
         <ScrollContainer scrollKey='followers' shouldUpdateScroll={this.shouldUpdateScroll}>
           <div className='scrollable' onScroll={this.handleScroll}>