diff --git a/src/App.css b/src/App.css index 5a70756..30a2548 100644 --- a/src/App.css +++ b/src/App.css @@ -18,6 +18,15 @@ body { font-family: "Roboto Condensed", sans-serif; } +#menu{ + height: 2rem; + display: none; + filter: brightness(0) saturate(100%) invert(72%) sepia(0%) saturate(1%) hue-rotate(151deg) brightness(95%) contrast(86%); + float: right; + margin-right: 1rem; + margin-top: .25rem; +} + h1, h2 { color: #ecebeb; } @@ -296,6 +305,10 @@ a { @media screen and (max-width: 1200px) { + #menu{ + display: unset; + } + .navBar { flex-direction: column; } diff --git a/src/App.js b/src/App.js index 6db0734..b88c755 100644 --- a/src/App.js +++ b/src/App.js @@ -1,11 +1,12 @@ import { Route, Link, Routes, HashRouter as Router } from 'react-router-dom' import './App.css'; -// import ReactGA from 'react-ga' +import menu from './assets/menu.svg' import Nav from './componets/Nav.js' import Socials from './componets/Socials.js' import Home from './pages/Home.js' import Projects from './pages/Projects'; +import Activities from './pages/Activities'; import AboutMe from './pages/AboutMe'; import AOS from 'aos'; import 'aos/dist/aos.css'; // You can also use for styles @@ -17,16 +18,19 @@ function App() {

Andrew Simonson

+ menu
}> }> + }> }>
diff --git a/src/assets/menu.svg b/src/assets/menu.svg new file mode 100644 index 0000000..562f644 --- /dev/null +++ b/src/assets/menu.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mobileMenu.js b/src/mobileMenu.js new file mode 100644 index 0000000..c0e7e8b --- /dev/null +++ b/src/mobileMenu.js @@ -0,0 +1,4 @@ +export function toggleMenu(){ + const e = document.querySelector(".navControl"); + e.style.display = ""; + } \ No newline at end of file diff --git a/src/responsive.js b/src/responsive.js index 3bb4ca1..cab8784 100644 --- a/src/responsive.js +++ b/src/responsive.js @@ -1,15 +1,49 @@ -window.onscroll = function() {scrollFunction()}; +window.onload = function () { onLoaded() }; + + +function onLoaded() { + scrollFunction(); + resizer(); + window.onresize = function () { resizer() }; + document.getElementById("menu").onclick = function () { toggleMenu() }; +} + +function resizer() { + scrollFunction(); + const e = document.querySelector(".navControl"); + if (window.innerWidth > 1200) { // desktop view + e.style.display = ""; + window.onscroll = function () { scrollFunction() }; + } + else { // mobile view + e.style.display = "none"; + window.onscroll = ''; + document.querySelector('.header').style.backgroundColor = '#1a1a1a'; + document.querySelector('.header > a > h1').style.fontSize = "1.5rem"; + // document.querySelector('.header > h1').style.color = "#a8a8a8"; + document.querySelectorAll('.navElement').forEach(x => { x.style.paddingTop = '.3rem'; x.style.paddingBottom = '.3rem'; x.style.fontSize = '1rem' }); + } +} function scrollFunction() { if (document.body.scrollTop > 10 || document.documentElement.scrollTop > 10) { document.querySelector('.header').style.backgroundColor = '#1a1a1a'; document.querySelector('.header > a > h1').style.fontSize = "1.5rem"; // document.querySelector('.header > h1').style.color = "#a8a8a8"; - document.querySelectorAll('.navElement').forEach(x => {x.style.paddingTop = '.3rem'; x.style.paddingBottom = '.3rem'; x.style.fontSize='1rem'}); + document.querySelectorAll('.navElement').forEach(x => { x.style.paddingTop = '.3rem'; x.style.paddingBottom = '.3rem'; x.style.fontSize = '1rem' }); } else { document.querySelector('.header').style.backgroundColor = 'rgba(0,0,0,0)'; document.querySelector('.header > a > h1').style.fontSize = "2rem"; // document.querySelector('.header > h1').style.color = "#ecebeb"; - document.querySelectorAll('.navElement').forEach(x => {x.style.paddingTop = '.5rem'; x.style.paddingBottom = '.5rem'; x.style.fontSize='1.2rem'}); + document.querySelectorAll('.navElement').forEach(x => { x.style.paddingTop = '.5rem'; x.style.paddingBottom = '.5rem'; x.style.fontSize = '1.2rem' }); } -} \ No newline at end of file +} + +function toggleMenu(){ + const e = document.querySelector(".navControl"); + if(e.style.display === "none"){ + e.style.display = ""; + } else { + e.style.display = "none"; + } +} \ No newline at end of file