From b7979c2c0c5443b4f7e1d970ab0422c19f49d4ad Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Thu, 2 Mar 2023 08:59:06 +0700
Subject: Add mobile view and desktop view component

---
 src/core/components/views/DesktopView.jsx | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 src/core/components/views/DesktopView.jsx

(limited to 'src/core/components/views/DesktopView.jsx')

diff --git a/src/core/components/views/DesktopView.jsx b/src/core/components/views/DesktopView.jsx
new file mode 100644
index 00000000..31a67936
--- /dev/null
+++ b/src/core/components/views/DesktopView.jsx
@@ -0,0 +1,14 @@
+import isMobile from 'is-mobile'
+import { useEffect, useState } from 'react'
+
+const DesktopView = ({ children }) => {
+  const [view, setView] = useState(<></>)
+
+  useEffect(() => {
+    if (!isMobile()) setView(children)
+  }, [children])
+
+  return view
+}
+
+export default DesktopView
-- 
cgit v1.2.3

