Skip to content

Commit a2a6089

Browse files
authored
Merge pull request #245 from WatchItDev/v2/responsive/placeholder
feat: handle responsive capabilities
2 parents edb7bdb + 62c9fdb commit a2a6089

File tree

6 files changed

+57
-0
lines changed

6 files changed

+57
-0
lines changed
Loading

src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import MotionLazy from '@src/components/animate/motion-lazy';
3939
import SnackbarProvider from '@src/components/snackbar/snackbar-provider';
4040
import { SettingsProvider, SettingsDrawer } from '@src/components/settings';
4141
import { AuthProvider } from '@src/auth/context/lens';
42+
import {ResponsiveOverlay} from "@src/components/responsive-overlay";
4243

4344
// ----------------------------------------------------------------------
4445

@@ -76,6 +77,7 @@ export default function App() {
7677
<SettingsDrawer />
7778
<ProgressBar />
7879
<Router />
80+
<ResponsiveOverlay />
7981
</SnackbarProvider>
8082
</MotionLazy>
8183
</ThemeProvider>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { useState, useEffect } from 'react';
2+
import { Box, Typography } from '@mui/material';
3+
import Image from "@src/components/image";
4+
import responsiveImage from '@public/assets/illustrations/working-responsive.png';
5+
6+
const ResponsiveOverlay = () => {
7+
const [isSmallScreen, setIsSmallScreen] = useState(false);
8+
9+
useEffect(() => {
10+
const handleResize = () => {
11+
setIsSmallScreen(window.innerWidth < 1200);
12+
};
13+
14+
window.addEventListener('resize', handleResize);
15+
handleResize();
16+
17+
return () => window.removeEventListener('resize', handleResize);
18+
}, []);
19+
20+
if (!isSmallScreen) {
21+
return null;
22+
}
23+
24+
return (
25+
<Box
26+
sx={{
27+
position: 'fixed',
28+
top: 0,
29+
left: 0,
30+
width: '100%',
31+
height: '100%',
32+
backgroundColor: 'rgba(0, 0, 0, 0.8)',
33+
color: '#fff',
34+
display: 'flex',
35+
flexDirection: 'column',
36+
alignItems: 'center',
37+
justifyContent: 'center',
38+
zIndex: 2000,
39+
}}
40+
>
41+
42+
<Image src={responsiveImage} alt="Watchit App" sx={{ width: 350}} />
43+
<Box sx={{ m: 4 }} />
44+
<Typography variant="h6">Watchit App</Typography>
45+
<Typography variant="h6">
46+
We are working on making this page responsive.
47+
</Typography>
48+
</Box>
49+
);
50+
};
51+
52+
export default ResponsiveOverlay;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as ResponsiveOverlay } from './ResponsiveOverlay.tsx';

tsconfig.app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/* Aliases */
2626
"paths": {
2727
"@src/*": ["./src/*"],
28+
"@public/*": ["./public/*"],
2829
}
2930
},
3031
"include": ["src"]

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default defineConfig(({ mode }) => {
1111
resolve: {
1212
alias: {
1313
'@src': path.resolve(__dirname, 'src'),
14+
'@public': path.resolve(__dirname, 'public'),
1415
},
1516
},
1617
define: {

0 commit comments

Comments
 (0)