mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: remove offset top
This commit is contained in:
parent
f556e50be4
commit
ad0a6d01d2
@ -202,10 +202,6 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const setOffsetTop = (v: number) => {
|
|
||||||
foldersActions.setOffsetTop({ id: folder.id, offset: v });
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
showPages,
|
showPages,
|
||||||
onFolderNameClick,
|
onFolderNameClick,
|
||||||
@ -227,6 +223,5 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
|
|||||||
|
|
||||||
closePopup,
|
closePopup,
|
||||||
folderHeight,
|
folderHeight,
|
||||||
setOffsetTop,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -42,17 +42,12 @@ export const FolderItem = ({
|
|||||||
|
|
||||||
closePopup,
|
closePopup,
|
||||||
folderHeight,
|
folderHeight,
|
||||||
setOffsetTop,
|
|
||||||
} = useFolderEvents(folder, pages);
|
} = useFolderEvents(folder, pages);
|
||||||
|
|
||||||
const [popupY, setPopupY] = useState(0);
|
const [popupY, setPopupY] = useState(0);
|
||||||
|
|
||||||
const el = useRef<HTMLDivElement>(null);
|
const el = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setOffsetTop(el.current?.offsetTop || 0);
|
|
||||||
}, [el, showPages]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (el.current) {
|
if (el.current) {
|
||||||
const { top } = el.current.getBoundingClientRect();
|
const { top } = el.current.getBoundingClientRect();
|
||||||
|
@ -60,10 +60,6 @@ export const usePageEvents = (page: IPage) => {
|
|||||||
setShowRenamePopup(false);
|
setShowRenamePopup(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const setOffsetTop = (v: number) => {
|
|
||||||
pagesActions.setOffsetTop({ id: page.id, offset: v });
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
showPageOptions,
|
showPageOptions,
|
||||||
onPageOptionsClick,
|
onPageOptionsClick,
|
||||||
@ -75,6 +71,5 @@ export const usePageEvents = (page: IPage) => {
|
|||||||
closePopup,
|
closePopup,
|
||||||
closeRenamePopup,
|
closeRenamePopup,
|
||||||
activePageId,
|
activePageId,
|
||||||
setOffsetTop,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -23,15 +23,10 @@ export const PageItem = ({ page, onPageClick }: { page: IPage; onPageClick: () =
|
|||||||
closePopup,
|
closePopup,
|
||||||
closeRenamePopup,
|
closeRenamePopup,
|
||||||
activePageId,
|
activePageId,
|
||||||
setOffsetTop,
|
|
||||||
} = usePageEvents(page);
|
} = usePageEvents(page);
|
||||||
|
|
||||||
const el = useRef<HTMLDivElement>(null);
|
const el = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setOffsetTop(el.current?.offsetTop || 0);
|
|
||||||
}, [el.current]);
|
|
||||||
|
|
||||||
const [popupY, setPopupY] = useState(0);
|
const [popupY, setPopupY] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -2,7 +2,6 @@ import React, { ReactNode, useEffect } from 'react';
|
|||||||
import { NavigationPanel } from './NavigationPanel/NavigationPanel';
|
import { NavigationPanel } from './NavigationPanel/NavigationPanel';
|
||||||
import { MainPanel } from './MainPanel';
|
import { MainPanel } from './MainPanel';
|
||||||
import { useNavigationPanelHooks } from './NavigationPanel/NavigationPanel.hooks';
|
import { useNavigationPanelHooks } from './NavigationPanel/NavigationPanel.hooks';
|
||||||
import { NavigationFloatingPanel } from './NavigationPanel/NavigationFloatingPanel';
|
|
||||||
import { useWorkspace } from './Workspace.hooks';
|
import { useWorkspace } from './Workspace.hooks';
|
||||||
import { useAppSelector } from '../../stores/store';
|
import { useAppSelector } from '../../stores/store';
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|||||||
export interface IFolder {
|
export interface IFolder {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
offsetTop?: number;
|
|
||||||
showPages?: boolean;
|
showPages?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,9 +24,6 @@ export const foldersSlice = createSlice({
|
|||||||
clearFolders() {
|
clearFolders() {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
setOffsetTop(state, action: PayloadAction<{ id: string; offset: number }>) {
|
|
||||||
return state.map((f) => (f.id === action.payload.id ? { ...f, offsetTop: action.payload.offset } : f));
|
|
||||||
},
|
|
||||||
toggleShowPages(state, action: PayloadAction<{ id: string }>) {
|
toggleShowPages(state, action: PayloadAction<{ id: string }>) {
|
||||||
return state.map((f) => (f.id === action.payload.id ? { ...f, showPages: !f.showPages } : f));
|
return state.map((f) => (f.id === action.payload.id ? { ...f, showPages: !f.showPages } : f));
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,6 @@ export interface IPage {
|
|||||||
title: string;
|
title: string;
|
||||||
pageType: ViewLayoutTypePB;
|
pageType: ViewLayoutTypePB;
|
||||||
folderId: string;
|
folderId: string;
|
||||||
offsetTop?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState: IPage[] = [];
|
const initialState: IPage[] = [];
|
||||||
@ -32,9 +31,6 @@ export const pagesSlice = createSlice({
|
|||||||
clearPages() {
|
clearPages() {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
setOffsetTop(state, action: PayloadAction<{ id: string; offset: number }>) {
|
|
||||||
return state.map((page) => (page.id === action.payload.id ? { ...page, offsetTop: action.payload.offset } : page));
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user