Add hooks

This commit is contained in:
jeffvli
2022-12-11 01:19:18 -08:00
parent f392fbab83
commit 528a118239
3 changed files with 22 additions and 0 deletions
+2
View File
@@ -1 +1,3 @@
export * from './use-theme';
export * from './use-is-mounted';
export * from './use-should-pad-titlebar';
@@ -0,0 +1,11 @@
import { useEffect, useState } from 'react';
export const useIsMounted = () => {
const [isMounted, setIsMounted] = useState(false);
useEffect(() => {
setIsMounted(true);
}, []);
return isMounted;
};
@@ -0,0 +1,9 @@
import { useSidebarRightExpanded } from '/@/store';
import { useGeneralSettings } from '/@/store/settings.store';
export const useShouldPadTitlebar = () => {
const isSidebarExpanded = useSidebarRightExpanded();
const { sideQueueType } = useGeneralSettings();
return !(isSidebarExpanded && sideQueueType === 'sideQueue');
};