Skip to content

Commit

Permalink
Merge pull request #245 from WatchItDev/v2/responsive/placeholder
Browse files Browse the repository at this point in the history
feat: handle responsive capabilities
  • Loading branch information
Jadapema authored Nov 5, 2024
2 parents edb7bdb + 62c9fdb commit a2a6089
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import MotionLazy from '@src/components/animate/motion-lazy';
import SnackbarProvider from '@src/components/snackbar/snackbar-provider';
import { SettingsProvider, SettingsDrawer } from '@src/components/settings';
import { AuthProvider } from '@src/auth/context/lens';
import {ResponsiveOverlay} from "@src/components/responsive-overlay";

// ----------------------------------------------------------------------

Expand Down Expand Up @@ -76,6 +77,7 @@ export default function App() {
<SettingsDrawer />
<ProgressBar />
<Router />
<ResponsiveOverlay />
</SnackbarProvider>
</MotionLazy>
</ThemeProvider>
Expand Down
52 changes: 52 additions & 0 deletions src/components/responsive-overlay/ResponsiveOverlay.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { useState, useEffect } from 'react';
import { Box, Typography } from '@mui/material';
import Image from "@src/components/image";
import responsiveImage from '@public/assets/illustrations/working-responsive.png';

const ResponsiveOverlay = () => {
const [isSmallScreen, setIsSmallScreen] = useState(false);

useEffect(() => {
const handleResize = () => {
setIsSmallScreen(window.innerWidth < 1200);
};

window.addEventListener('resize', handleResize);
handleResize();

return () => window.removeEventListener('resize', handleResize);
}, []);

if (!isSmallScreen) {
return null;
}

return (
<Box
sx={{
position: 'fixed',
top: 0,
left: 0,
width: '100%',
height: '100%',
backgroundColor: 'rgba(0, 0, 0, 0.8)',
color: '#fff',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
zIndex: 2000,
}}
>

<Image src={responsiveImage} alt="Watchit App" sx={{ width: 350}} />
<Box sx={{ m: 4 }} />
<Typography variant="h6">Watchit App</Typography>
<Typography variant="h6">
We are working on making this page responsive.
</Typography>
</Box>
);
};

export default ResponsiveOverlay;
1 change: 1 addition & 0 deletions src/components/responsive-overlay/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ResponsiveOverlay } from './ResponsiveOverlay.tsx';
1 change: 1 addition & 0 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
/* Aliases */
"paths": {
"@src/*": ["./src/*"],
"@public/*": ["./public/*"],
}
},
"include": ["src"]
Expand Down
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default defineConfig(({ mode }) => {
resolve: {
alias: {
'@src': path.resolve(__dirname, 'src'),
'@public': path.resolve(__dirname, 'public'),
},
},
define: {
Expand Down

0 comments on commit a2a6089

Please sign in to comment.