refactor: update UI components and styles for improved consistency and functionality
- Refactored Skeleton component to include data-slot attribute and updated class names. - Enhanced Switch component with size prop and improved styling. - Updated Tooltip components to include data-slot attributes and improved styling. - Refactored global CSS to use custom properties for theming and improved dark mode support. - Added useIsMobile hook for responsive design handling. - Updated IPC link implementation for tRPC in Electron. - Adjusted ProjectsPage layout for better responsiveness. - Removed outdated Tailwind configuration file and integrated Tailwind CSS with Vite.
This commit is contained in:
19
src/renderer/hooks/use-mobile.ts
Normal file
19
src/renderer/hooks/use-mobile.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as React from "react"
|
||||
|
||||
const MOBILE_BREAKPOINT = 768
|
||||
|
||||
export function useIsMobile() {
|
||||
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
|
||||
|
||||
React.useEffect(() => {
|
||||
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
||||
const onChange = () => {
|
||||
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
||||
}
|
||||
mql.addEventListener("change", onChange)
|
||||
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
||||
return () => mql.removeEventListener("change", onChange)
|
||||
}, [])
|
||||
|
||||
return !!isMobile
|
||||
}
|
||||
Reference in New Issue
Block a user