Skip to content

Commit

Permalink
💄Nav
Browse files Browse the repository at this point in the history
  • Loading branch information
noeypatt committed Apr 2, 2020
1 parent 96fddfc commit d49e620
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 22 deletions.
14 changes: 12 additions & 2 deletions components/layout/nav.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useState } from 'react'
import React, { useState, useEffect } from 'react'
import Link from 'next/link'
import { useMediaQuery } from 'react-responsive';

const NavBar = props => {

const tab = props.tab
const name = props.name
const [navbar,setNavbar] = useState("")
const [status, setStatus] = useState(false)
const isBigScreen = useMediaQuery({ minDeviceWidth: 769 })
const isSmallScreen = useMediaQuery({ maxDeviceWidth: 768.99 })
Expand All @@ -22,13 +23,22 @@ const NavBar = props => {
}
}

useEffect(() => {
window.onscroll = () => {
if (window.scrollY <= 10)
setNavbar(null)
else
setNavbar("scroll")
};
}, [])

return (
<React.Fragment>
{
typeof document === 'undefined' ?
null :
isBigScreen && name == "index" ?
<nav>
<nav className={navbar}>
<ul>
<Link href="/">
<li>
Expand Down
21 changes: 11 additions & 10 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,21 @@ const Home = () => {
{
typeof document === 'undefined' ?
null :
<div className="warp-index">
<React.Fragment>
<Head>
<title>Eldery DB</title>
<link rel='icon' href='/static/logomain.svg' />
</Head>
<React.Fragment>
<NavBar name="index" tab={isSmallScreen ? homeMin : home} confirm={onConfirm} />
<Cover />
<About />
<Agency />
<Info />
<Footer />
</React.Fragment>
</div>
<NavBar name="index" tab={isSmallScreen ? homeMin : home} confirm={onConfirm} />
<div className="warp-index">
<Cover />
<About />
<Agency />
<Info />
<Footer />
</div>
</React.Fragment>

}
</React.Fragment>

Expand Down
1 change: 1 addition & 0 deletions styles/cover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ $border-bg-color: 1px solid #83d2ae;


.warp-cover {
margin-top: 5rem;
// position: relative;
// text-align: center;
// line-height: 0;
Expand Down
44 changes: 34 additions & 10 deletions styles/nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,43 @@ $bg-color: linear-gradient(to left, #a6d254, #83d2ae);
$border-bg-color: 1px solid #83d2ae;
$line-color: #e8e9fe;

.warp-index {
nav {
width: 100%;
min-height: 5rem;
ul {
user-select: none;
padding: 0.5rem;
display: flex;
justify-content: space-between;
}

nav {
width: 100%;
min-height: 5rem;
ul {
user-select: none;
padding: 0.5rem;
display: flex;
justify-content: space-between;
}
}


//Navbar-Scroll
// nav {
// position: fixed;
// width: 100%;
// min-height: 5rem;
// top: 0;
// z-index: 1000;
// ul {
// user-select: none;
// padding: 0.5rem;
// display: flex;
// justify-content: space-between;
// }
// }

// nav.scroll {
// position: fixed;
// width: 100%;
// top: 0;
// z-index: 1000;
// background-color: greenyellow;
// transition: background-color 0.4s ease-out;
// }

.warp-main {
ul {
cursor: pointer;
Expand Down

1 comment on commit d49e620

@vercel
Copy link

@vercel vercel bot commented on d49e620 Apr 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.