mirror of
https://github.com/Buriburizaem0n/nezha-dash-v1.git
synced 2026-02-04 12:40:10 +00: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:
@@ -62,11 +62,25 @@ export default function Servers() {
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const inlineState = localStorage.getItem("inline")
|
||||
if (window.ForceCardInline) {
|
||||
setInline("1")
|
||||
} else if (inlineState !== null) {
|
||||
setInline(inlineState)
|
||||
const checkInlineSettings = () => {
|
||||
const isMobile = window.innerWidth < 768
|
||||
|
||||
if (!isMobile) {
|
||||
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)
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user