mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-16 16:34:24 +02:00
Add hooks
This commit is contained in:
@@ -1 +1,3 @@
|
|||||||
export * from './use-theme';
|
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');
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user