forked from TWChennai/geeknight
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement a simple layout & menu system
- Loading branch information
1 parent
23a5c68
commit 8d7daa4
Showing
6 changed files
with
107 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { useState } from "react"; | ||
import { Link } from "@reach/router"; | ||
|
||
import "./layout.scss"; | ||
import logo from "../../assets/logo.svg"; | ||
import menu from "../../assets/menu.svg"; | ||
|
||
const isPartiallyActive = ({ isPartiallyCurrent }) => { | ||
return isPartiallyCurrent ? { className: "active" } : {}; | ||
}; | ||
const isActive = ({ isCurrent }) => { | ||
return isCurrent ? { className: "active" } : {}; | ||
}; | ||
|
||
export default ({ children }) => { | ||
const [menuState, setMenuState] = useState(false); | ||
const toggleMenu = () => setMenuState(!menuState); | ||
|
||
const Menu = menuState ? ( | ||
<ul className="menu"> | ||
<Link getProps={isActive} to="/"> | ||
<li>Home</li> | ||
</Link> | ||
<Link getProps={isPartiallyActive} to="/events"> | ||
<li>Events</li> | ||
</Link> | ||
</ul> | ||
) : null; | ||
return ( | ||
<div className="layout"> | ||
<nav> | ||
<div className="topbar"> | ||
<Link to="/"> | ||
<img className="logo" src={logo} alt="GeekNight Logo" /> | ||
</Link> | ||
<div className="menu-toggle" onClick={toggleMenu}> | ||
<span> | ||
<b>Menu</b> | ||
</span> | ||
<img src={menu} alt="Menu icon" /> | ||
</div> | ||
</div> | ||
{Menu} | ||
</nav> | ||
{children} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
body { | ||
background: red; | ||
} | ||
|
||
nav { | ||
display: flex; | ||
flex-flow: column; | ||
justify-content: flex-start; | ||
min-height: 60px; | ||
background: white; | ||
} | ||
|
||
.topbar { | ||
display: flex; | ||
flex-flow: row; | ||
justify-content: space-between; | ||
margin: 15px; | ||
} | ||
|
||
.logo { | ||
height: 40px; | ||
} | ||
.menu-toggle { | ||
margin: auto 0; | ||
} | ||
.menu-toggle:hover { | ||
cursor: pointer; | ||
} | ||
|
||
.menu-toggle img { | ||
margin: 0; | ||
display: inline-block; | ||
vertical-align: middle; | ||
} | ||
.menu-toggle span { | ||
vertical-align: middle; | ||
margin-right: 5px; | ||
} | ||
|
||
.active { | ||
color: blueviolet; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
@import-normalize; /* bring in normalize.css styles */ | ||
@import '~bulma/css/bulma.css'; /* import our bulma css framework */ | ||
|
||
@import "~bulma/css/bulma.css"; /* import our bulma css framework */ |