From 617f6c7a668af8139377b12079554e6e21e9a637 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Fri, 28 Oct 2022 17:07:27 +0300
Subject: Drop scrolling header
---
vnext/src/App.js | 51 ++-------------------------------------------------
1 file changed, 2 insertions(+), 49 deletions(-)
(limited to 'vnext')
diff --git a/vnext/src/App.js b/vnext/src/App.js
index c542dec5..e6798b31 100644
--- a/vnext/src/App.js
+++ b/vnext/src/App.js
@@ -1,6 +1,5 @@
import { useState, useEffect, useRef } from 'react';
import { Route, Link, Routes } from 'react-router-dom';
-import { useScroll, useRafState } from 'react-use';
import qs from 'qs';
import svg4everybody from 'svg4everybody';
@@ -20,10 +19,6 @@ import { useCookies } from 'react-cookie';
import { me } from './api';
-const elClassHidden = 'header--hidden';
-
-const elClassTop = 'content--top';
-
/**
*
*/
@@ -58,48 +53,6 @@ export default function App({ footer }) {
});
};
- const [scrollState, setScrollState] = useRafState({
- hidden: false,
- top: false,
- prevScroll: 0
- });
-
- let { x, y } = useScroll(contentRef);
-
- useEffect(() => {
- let dHeight = contentRef.current.scrollHeight;
- let wHeight = contentRef.current.clientHeight;
- setScrollState((scrollState) => {
- let wScrollDiff = scrollState.prevScroll - y;
- let hidden = scrollState.hidden;
- let top = scrollState.top;
- if (y <= 0) {
- // scrolled to the very top; element sticks to the top
- hidden = false;
- top = true;
- } else if ((wScrollDiff > 0) && hidden) {
- // scrolled up; element slides in
- hidden = false;
- top = false;
- } else if (wScrollDiff < 0) {
- // scrolled down
- if ((y + wHeight) >= dHeight && hidden) {
- // scrolled to the very bottom; element slides in
- hidden = false;
- top = false;
- } else {
- // scrolled down; element slides out
- hidden = true;
- top = false;
- }
- }
- return {
- hidden: hidden,
- top: top,
- prevScroll: y
- };
- });
- }, [x, y, setScrollState]);
const [hash, setHash] = useState(cookie.hash);
const [eventSource, setEventSource] = /** @param EventSource? */ useState({});
@@ -151,7 +104,7 @@ export default function App({ footer }) {
};
return (
<>
-