mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 17:41:56 +08:00
feat: improve inline settings handling for mobile responsiveness (#34)
* feat: improve inline settings handling for mobile responsiveness * chore: auto-fix linting and formatting issues
This commit is contained in:
parent
99d349b0ed
commit
1a38ce8c77
@ -62,11 +62,25 @@ export default function Servers() {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const inlineState = localStorage.getItem("inline")
|
const checkInlineSettings = () => {
|
||||||
if (window.ForceCardInline) {
|
const isMobile = window.innerWidth < 768
|
||||||
setInline("1")
|
|
||||||
} else if (inlineState !== null) {
|
if (!isMobile) {
|
||||||
setInline(inlineState)
|
const inlineState = localStorage.getItem("inline")
|
||||||
|
if (window.ForceCardInline) {
|
||||||
|
setInline("1")
|
||||||
|
} else if (inlineState !== null) {
|
||||||
|
setInline(inlineState)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkInlineSettings()
|
||||||
|
|
||||||
|
window.addEventListener("resize", checkInlineSettings)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("resize", checkInlineSettings)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user