feat: Added swipe gestures for dismissing panes on mobile (#2201)

This commit is contained in:
Aman Harwara
2023-02-07 12:51:16 +05:30
committed by GitHub
parent f0d49f6b21
commit 1d052c3dd1
10 changed files with 205 additions and 14 deletions

View File

@@ -43,6 +43,8 @@ import { HistoryModalController } from '@/Controllers/NoteHistory/HistoryModalCo
import { PaneController } from '@/Controllers/PaneController/PaneController'
import EmptyFilesView from './EmptyFilesView'
import { PaneLayout } from '@/Controllers/PaneController/PaneLayout'
import { usePaneSwipeGesture } from '../Panes/usePaneGesture'
import { mergeRefs } from '@/Hooks/mergeRefs'
type Props = {
accountMenuController: AccountMenuController
@@ -303,12 +305,14 @@ const ContentListView = forwardRef<HTMLDivElement, Props>(
}
}, [selectedUuids, innerRef, isCurrentNoteTemplate, renderedItems, panes])
const [setElement] = usePaneSwipeGesture('right', () => setPaneLayout(PaneLayout.TagSelection))
return (
<div
id={id}
className={classNames(className, 'sn-component section h-full overflow-hidden pt-safe-top')}
aria-label={'Notes & Files'}
ref={innerRef}
ref={mergeRefs([innerRef, setElement])}
>
{isMobileScreen && (
<FloatingAddButton onClick={addNewItem} label={addButtonLabel} style={dailyMode ? 'danger' : 'info'} />