Skip to content

Commit

Permalink
add styles for mobile
Browse files Browse the repository at this point in the history
closes #48
  • Loading branch information
JeelRajodiya committed Jul 30, 2024
1 parent d1bbb15 commit 03f7545
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/mobile/page.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.main {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
padding-inline: 12px;
}

.message {
font-weight: 500;
}
25 changes: 25 additions & 0 deletions app/mobile/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use client";

import React, { useEffect } from "react";
import styles from "./page.module.css";
import classnames from "classnames";
import { outfitFont } from "../styles/fonts";

export default function Mobile() {
useEffect(() => {
// if not on mobile, redirect to the main page
if (window.innerWidth > 768) {
window.location.href = "/";
}
}, []);
return (
<div className={styles.main}>
<div className={classnames(styles.message, outfitFont.className)}>
We are sorry,
<br />
Tour of JSON Schema is not optimized for mobile devices. Please use a
desktop computer for the best experience.
</div>
</div>
);
}
9 changes: 8 additions & 1 deletion app/providers.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
"use client";
import { ChakraProvider, ColorModeScript } from "@chakra-ui/react";
import { ChakraProvider } from "@chakra-ui/react";
import { theme } from "./styles/theme";
import { useEffect } from "react";

export function Providers({ children }: { children: React.ReactNode }) {
useEffect(() => {
if (window.innerWidth < 768 && !window.location.href.includes("/mobile")) {
window.location.href = "/mobile";
}
}, []);

return <ChakraProvider theme={theme}>{children}</ChakraProvider>;
}

0 comments on commit 03f7545

Please sign in to comment.