[Refactor] Reorganize config hooks into config_page_setter folder.
This commit is contained in:
1 parent
db820375f1
commit
5cbd7618e3
8 files changed
+11
-28
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { store, useStore_SettingBoxScrollPosition } from "@store";
|
||||
|
||||
export const useSettingBoxScrollPosition = () => {
|
||||
const { currentSettingBoxScrollPosition, updateSettingBoxScrollPosition, pendingSettingBoxScrollPosition } = useStore_SettingBoxScrollPosition();
|
||||
|
||||
const saveScrollPosition = () => {
|
||||
if (store.setting_box_scroll_container.current) {
|
||||
updateSettingBoxScrollPosition(store.setting_box_scroll_container.current.scrollTop);
|
||||
}
|
||||
};
|
||||
const restoreScrollPosition = () => {
|
||||
if (store.setting_box_scroll_container.current) {
|
||||
updateSettingBoxScrollPosition((pre) => {
|
||||
store.setting_box_scroll_container.current.scrollTop = pre.data;
|
||||
return pre.data;
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
const resetScrollPosition = () => {
|
||||
if (store.setting_box_scroll_container.current) {
|
||||
store.setting_box_scroll_container.current.scrollTop = 0;
|
||||
updateSettingBoxScrollPosition(0);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
saveScrollPosition,
|
||||
restoreScrollPosition,
|
||||
resetScrollPosition,
|
||||
currentSettingBoxScrollPosition,
|
||||
updateSettingBoxScrollPosition,
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user