Repository navigation
Expand file tree
/
Copy pathApp.js
More file actions
61 lines (56 loc) · 1.74 KB
/
Copy pathApp.js
File metadata and controls
61 lines (56 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React, { useEffect } from 'react';
import { createRoot } from 'react-dom/client';
import { createGlobalStyle } from 'styled-components';
import { useMediaQuery } from 'react-responsive';
import WideScreenHero from './Slides/WideScreen/HeroSlide/Hero';
import WideScreenWork from './Slides/WideScreen/WorkSlide/Work';
import WideScreenSkills from './Slides/WideScreen/Skills';
import WideScreenContact from './Slides/WideScreen/ContactSlide/Contact';
import MobileHero from './Slides/Mobile/HeroSlide/Hero';
import MobileWork from './Slides/Mobile/WorkSlide/Work';
import MobileSkills from './Slides/Mobile/Skills';
import MobileContact from './Slides/Mobile/ContactSlide/Contact';
import './Assets/index.css';
const GlobalStyle = createGlobalStyle`
html, body { margin: 0;}
*, *:before, *:after { box-sizing: border-box; }
`;
const App = () => {
// Use the useMediaQuery hook instead of MediaQuery component
const isDesktopOrLaptop = useMediaQuery({ minWidth: 1224 });
const isMobile = useMediaQuery({ maxWidth: 1223 });
useEffect(() => {
if ('scrollRestoration' in window.history) {
window.history.scrollRestoration = 'manual';
}
}, []);
return (
<>
{isDesktopOrLaptop && (
<>
<WideScreenHero />
<WideScreenWork />
<WideScreenSkills />
<WideScreenContact />
</>
)}
{isMobile && (
<>
<MobileHero />
<MobileWork />
<MobileSkills />
<MobileContact />
</>
)}
<GlobalStyle />
</>
);
};
// React 18 way of rendering with createRoot API
const container = document.getElementById('root');
const root = createRoot(container);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);