another step for constructing base project

This commit is contained in:
hamid
2026-06-17 22:53:49 +03:30
parent 5b4c0d183f
commit 5388bea320
76 changed files with 3836 additions and 1961 deletions
+7 -10
View File
@@ -1,17 +1,14 @@
import { useCallback } from 'react';
import { useAppStore } from '../store';
import { useColorScheme } from '@mui/material/styles';
/**
* Returns event handler to toggle Dark/Light modes
* @returns {function} calling this event toggles dark/light mode
* Returns an event handler that toggles dark/light mode via MUI's CSS-vars system.
* Calling the returned function sets data-mui-color-scheme on <html> — no React
* re-render happens outside the component that calls this hook.
*/
export function useEventSwitchDarkMode() {
const [state, dispatch] = useAppStore();
const { mode, setMode } = useColorScheme();
return useCallback(() => {
dispatch({
type: 'DARK_MODE',
payload: !state.darkMode,
});
}, [state, dispatch]);
setMode(mode === 'dark' ? 'light' : 'dark');
}, [mode, setMode]);
}
+1 -1
View File
@@ -14,7 +14,7 @@ export const SERVER_SIDE_MOBILE_FIRST = true; // true - for mobile, false - for
export function useIsMobileByWindowsResizing() {
const theme = useTheme();
const { width } = useWindowsSize();
const onMobile = width <= theme.breakpoints?.values?.sm ?? MOBILE_SCREEN_MAX_WIDTH;
const onMobile = width <= (theme.breakpoints?.values?.sm ?? MOBILE_SCREEN_MAX_WIDTH);
return onMobile;
}