From 64051f3b3fa7a01a34d580d338a85e166651353b Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 27 Jun 2023 12:11:49 +0800 Subject: [PATCH] Use full width for highlights pane on smaller screens --- .../templates/article/HighlightsLayer.tsx | 33 +++---------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/packages/web/components/templates/article/HighlightsLayer.tsx b/packages/web/components/templates/article/HighlightsLayer.tsx index 2914a08c0..b2fa49ce7 100644 --- a/packages/web/components/templates/article/HighlightsLayer.tsx +++ b/packages/web/components/templates/article/HighlightsLayer.tsx @@ -30,6 +30,7 @@ import SlidingPane from 'react-sliding-pane' import 'react-sliding-pane/dist/react-sliding-pane.css' import { NotebookContent } from './Notebook' import { NotebookHeader } from './NotebookHeader' +import useGetWindowDimensions from '../../../lib/hooks/useGetWindowDimensions' type HighlightsLayerProps = { viewer: UserBasicData @@ -86,6 +87,8 @@ export function HighlightsLayer(props: HighlightsLayerProps): JSX.Element { const [labelsTarget, setLabelsTarget] = useState(undefined) + const windowDimensions = useGetWindowDimensions() + const createHighlightFromSelection = useCallback( async ( selection: SelectionAttributes, @@ -751,7 +754,7 @@ export function HighlightsLayer(props: HighlightsLayerProps): JSX.Element { ) - - { - /* return ( - { - // The timeout here is a bit of a hack to work around rerendering - setTimeout(() => { - const target = document.querySelector( - `[omnivore-highlight-id="${highlightId}"]` - ) - target?.scrollIntoView({ - block: 'center', - behavior: 'auto', - }) - }, 1) - history.replaceState( - undefined, - window.location.href, - `#${highlightId}` - ) - props.setShowHighlightsModal(false) - }} - /> - ) */ - } } return <>