Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: show scrollbar in notes list on hover (fixes streetwriters/notesnook#327)

thecodrrb58f1e7cd4f6
diff --git a/apps/web/src/components/scroll-container/index.js b/apps/web/src/components/scroll-container/index.js
index 20d2a1a85..e8d74e1e1 100644
--- a/apps/web/src/components/scroll-container/index.js
+++ b/apps/web/src/components/scroll-container/index.js
@@ -1,17 +1,33 @@
-import React from "react";
+import React, { useRef } from "react";
import { Box } from "rebass";
import { Scrollbars } from "rc-scrollbars";
import "./style.css";
const ScrollContainer = ({ children, style, forwardedRef, ...props }) => {
+ const ref = useRef();
return (
<Scrollbars
{...props}
autoHide
- ref={(sRef) => forwardedRef && sRef && forwardedRef(sRef.view)}
+ ref={(sRef) => {
+ forwardedRef && sRef && forwardedRef(sRef.view);
+ ref.current = sRef;
+ }}
style={{ ...style, overflowY: "hidden" }}
renderView={({ style, ...props }) => (
- <Box {...props} style={{ ...style, inset: "-1px" }} />
+ <Box
+ {...props}
+ style={{ ...style, inset: "-1px" }}
+ onMouseEnter={() => {
+ const height = ref.current.getThumbVerticalHeight();
+ const width = ref.current.getThumbHorizontalWidth();
+ if (height !== ref.current.thumbVertical.style.height)
+ ref.current.thumbVertical.style.height = `${height}px`;
+ else if (ref.current.thumbHorizontal.style.width !== width) {
+ ref.current.thumbHorizontal.style.width = `${width}px`;
+ }
+ }}
+ />
)}
renderThumbVertical={({ style, ...props }) => (
<Box