feat: added functionality to collapse/expand pinned list in user profile

This commit is contained in:
Moyasee
2025-09-26 16:54:10 +03:00
parent fd1f13225b
commit f027f05e02
4 changed files with 229 additions and 38 deletions

View File

@@ -0,0 +1,30 @@
import { useState, useCallback } from "react";
interface SectionCollapseState {
pinned: boolean;
library: boolean;
}
export function useSectionCollapse() {
const [collapseState, setCollapseState] = useState<SectionCollapseState>({
pinned: false,
library: false,
});
const toggleSection = useCallback(
(section: keyof SectionCollapseState) => {
setCollapseState(prevState => ({
...prevState,
[section]: !prevState[section],
}));
},
[]
);
return {
collapseState,
toggleSection,
isPinnedCollapsed: collapseState.pinned,
isLibraryCollapsed: collapseState.library,
};
}