forked from Archives/Athou_commafeed
use useMobile
This commit is contained in:
@@ -1,11 +1,8 @@
|
|||||||
import { Box, MediaQuery } from "@mantine/core"
|
import { Box } from "@mantine/core"
|
||||||
import { Constants } from "app/constants"
|
import { useMobile } from "hooks/useMobile"
|
||||||
import React from "react"
|
import React from "react"
|
||||||
|
|
||||||
export function OnDesktop(props: { children: React.ReactNode }) {
|
export function OnDesktop(props: { children: React.ReactNode }) {
|
||||||
return (
|
const mobile = useMobile()
|
||||||
<MediaQuery smallerThan={Constants.layout.mobileBreakpoint} styles={{ display: "none" }}>
|
return <Box>{!mobile && props.children}</Box>
|
||||||
<Box>{props.children}</Box>
|
|
||||||
</MediaQuery>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { Box, MediaQuery } from "@mantine/core"
|
import { Box } from "@mantine/core"
|
||||||
import { Constants } from "app/constants"
|
import { useMobile } from "hooks/useMobile"
|
||||||
import React from "react"
|
import React from "react"
|
||||||
|
|
||||||
export function OnMobile(props: { children: React.ReactNode }) {
|
export function OnMobile(props: { children: React.ReactNode }) {
|
||||||
return (
|
const mobile = useMobile()
|
||||||
<MediaQuery largerThan={Constants.layout.mobileBreakpoint} styles={{ display: "none" }}>
|
return <Box>{mobile && props.children}</Box>
|
||||||
<Box>{props.children}</Box>
|
|
||||||
</MediaQuery>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user