Adapt layout and sidebar for responsive mobile experience

Introduce a `useResponsive` hook, implement mobile-first sidebar behavior with a toggleable menu, and adjust layout for various screen sizes, along with minor type and deposit value handling in `CustomerOrderForm`.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: cc8ba926-557c-4bf1-a2ea-ceabbcf38824
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/cc8ba926-557c-4bf1-a2ea-ceabbcf38824/f2TM8xQ
This commit is contained in:
michaelschal committed 2025-08-12 19:44:39 +00:00
1 parent 479577c4ff
commit f1d6f27e3d
5 files changed
+241 -73

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
import { useState, useEffect } from "react";
interface ResponsiveState {
isMobile: boolean;
isTablet: boolean;
isDesktop: boolean;
screenWidth: number;
}
const BREAKPOINTS = {
mobile: 768,
tablet: 1024,
} as const;
export function useResponsive(): ResponsiveState {
const [state, setState] = useState<ResponsiveState>(() => {
if (typeof window === 'undefined') {
return {
isMobile: false,
isTablet: false,
isDesktop: true,
screenWidth: 1920,
};
}
const width = window.innerWidth;
return {
isMobile: width < BREAKPOINTS.mobile,
isTablet: width >= BREAKPOINTS.mobile && width < BREAKPOINTS.tablet,
isDesktop: width >= BREAKPOINTS.tablet,
screenWidth: width,
};
});
useEffect(() => {
const handleResize = () => {
const width = window.innerWidth;
setState({
isMobile: width < BREAKPOINTS.mobile,
isTablet: width >= BREAKPOINTS.mobile && width < BREAKPOINTS.tablet,
isDesktop: width >= BREAKPOINTS.tablet,
screenWidth: width,
});
};
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);
return state;
}
// Hook spécialisé pour la navigation mobile
export function useIsMobileNavigation() {
const { isMobile } = useResponsive();
return isMobile;
}