mirror of
https://github.com/logseq/logseq.git
synced 2026-04-26 15:15:01 +00:00
* chore(ui): add sidebar related components * chore(shui): add sidebar core * enhance(ui): WIP polish left sidebar * enhance(ui): polish opacity value * enhance(ui): remove unnecessary css * enhance(ui): simplify the left sidebar related css * enhance(ui): polish left sidebar navigations * enhance(ui): polish navigations items * enhance(ui): polish graphs picker from the left sidebar * enhance(ui): polish graphs selector * enhance(ui): graphs dropdown content * enhance(ux): create new page for the graphs selector section * enhance(ui): remote icon for the graphs selector * enhance(ui): polish sidebar navigations filter * fix(ui): background color for the left sidebar * enhance(ui): refactor names related with the left sidebar * enhance(ux): WIP configurable navigations from the left sidebar * enhance(ux): configurable navigations popup * enhance(ux): persist user navigations from the left sidebar * fix(ui): bad graph selector type icon * fix: lint * fix: lint * enhance(ui): polish details for the left sidebar * chore: remove shadcn sidebar component * chore: remove shadcn sidebar related component * fix(ui): text overflow for the page name item
20 lines
565 B
TypeScript
20 lines
565 B
TypeScript
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
|
|
}
|