Files
towercontrol/src/hooks/useIsMobile.ts
Julien Froidefond 361fc0eaac feat: enhance mobile and desktop layouts in Daily and Kanban pages
- Refactored `DailyPageClient` to prioritize mobile layout with today's section first and calendar at the bottom for better usability.
- Updated `KanbanPageClient` to include responsive controls for mobile, improving task management experience.
- Adjusted `DailyCheckboxItem` and `DailySection` for better touch targets and responsive design.
- Cleaned up `TODO.md` to reflect changes in mobile interface considerations and task management features.
2025-09-21 21:37:30 +02:00

29 lines
671 B
TypeScript

'use client';
import { useState, useEffect } from 'react';
/**
* Hook pour détecter si l'utilisateur est sur mobile
* Utilise un breakpoint à 640px (sm en Tailwind)
*/
export function useIsMobile(breakpoint: number = 640): boolean {
const [isMobile, setIsMobile] = useState(false);
useEffect(() => {
const checkIsMobile = () => {
setIsMobile(window.innerWidth < breakpoint);
};
// Check initial
checkIsMobile();
// Écouter les changements de taille
window.addEventListener('resize', checkIsMobile);
return () => {
window.removeEventListener('resize', checkIsMobile);
};
}, [breakpoint]);
return isMobile;
}