Created
November 27, 2015 12:30
-
-
Save adammcarth/146ab6b792d7ef0210e6 to your computer and use it in GitHub Desktop.
Potential navigation bar component in Marko JS
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
<!-- /src/pages/homepage/homepage.marko --> | |
<layout-use template="../../layouts/layout.marko" navbar-current="home"> | |
<layout-put into="body"> | |
... | |
</layout-put> | |
</layout-use> |
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
<!-- /src/layouts/layout.marko --> | |
<html> | |
<head> | |
</head> | |
<body> | |
<app-navbar current="${data.navbarCurrent}" /> | |
<layout-placeholder name="body" /> | |
</body> | |
</html> |
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
<!-- /src/components/app-navbar/template.marko --> | |
<div id="navbar"> | |
<p> | |
<a if="data.current === 'home'" href="/" class="current">Home</a><a else href="/">Home</a> | | |
<a if="data.current === 'about'" href="/about" class="current">About</a><a else href="/about">About</a> | | |
<a if="data.current === 'users'" href="/users" class="current">Users</a><a else href="/users">Users</a> | | |
<a if="data.current === 'blog'" href="/blog" class="current">Blog</a><a else href="/blog">Blog</a> | | |
<a if="data.current === 'contact'" href="/contact" class="current">Contact</a><a else href="/contact">Contact</a> | |
</p> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment