Skip to content

Commit

Permalink
Merge pull request #132 from shreyas1434shinde/main
Browse files Browse the repository at this point in the history
popup added better experience desktop view
  • Loading branch information
itsvick authored Dec 2, 2024
2 parents 02263ba + 27a7ddb commit 009efb2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"next-transpile-modules": "^10.0.1",
"react": "^18",
"react-dom": "^18",
"react-toastify": "^10.0.6",
"reflect-metadata": "^0.1.13",
"svg2img": "^1.0.0-beta.2",
"url": "^0.11.3",
Expand Down
29 changes: 28 additions & 1 deletion src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import React, { useEffect, useState } from "react";
import { Box } from "@mui/material";
import Sidebar from "./SideBar";
import { toast, ToastContainer } from "react-toastify";

interface LayoutProps {
children: React.ReactNode;
Expand All @@ -9,8 +10,34 @@ interface LayoutProps {
}

const Layout: React.FC<LayoutProps> = ({ children, selectedKey, onSelect }) => {
const [toastShown, setToastShown] = useState(false);

useEffect(() => {
const handleResize = () => {
if (window.innerWidth < 768 && !toastShown) {
toast.info("For a better experience, please use a desktop.", {
position: "top-center",
autoClose: false,
hideProgressBar: true,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
});
setToastShown(true); // Mark toast as shown
}
};

handleResize();

window.addEventListener("resize", handleResize);

return () => {
window.removeEventListener("resize", handleResize);
};
}, [toastShown]);
return (
<Box display="flex" sx={{ overflowX: 'hidden !important' }} minHeight={"100vh"}>
<ToastContainer position="bottom-left" autoClose={3000} stacked={false} />
<Box sx={{ maxHeight: '132vh', minHeight: '100vh', '@media (max-width: 900px)': { position: 'absolute', top:"3px" }, '@media (min-width: 900px)': { background: "linear-gradient(to bottom, white, #F8EFDA)", position:'fixed' } }}>
<Sidebar selectedKey={selectedKey} onSelect={onSelect} />
</Box>
Expand Down
6 changes: 6 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ import "../styles/global.css";

import { AppProps } from "next/app";
import customTheme from "@/styles/CustomTheme";
import { useEffect, useState } from "react";
import { toast, ToastContainer } from "react-toastify";

export default function App({ Component, pageProps }: AppProps) {



return (
<CssVarsProvider theme={customTheme}>
<ToastContainer position="bottom-left" autoClose={3000} stacked={false} />
<Component {...pageProps} />;
</CssVarsProvider>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/content/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const CreatePage = () => {
>
<Grid container spacing={2}>
{cardData.map((card, index) => (
<Grid item xs={12} sm={6} md={4} lg={4} xl={3} key={index}>
<Grid item xs={12} sm={6} md={4} lg={4} xl={4} key={index}>
<Paper
key={index}
elevation={3}
Expand Down

0 comments on commit 009efb2

Please sign in to comment.