Skip to content

Instantly share code, notes, and snippets.

@adammcarth
Created November 27, 2015 12:30
Show Gist options
  • Save adammcarth/146ab6b792d7ef0210e6 to your computer and use it in GitHub Desktop.
Save adammcarth/146ab6b792d7ef0210e6 to your computer and use it in GitHub Desktop.
Potential navigation bar component in Marko JS
<!-- /src/pages/homepage/homepage.marko -->
<layout-use template="../../layouts/layout.marko" navbar-current="home">
<layout-put into="body">
...
</layout-put>
</layout-use>
<!-- /src/layouts/layout.marko -->
<html>
<head>
</head>
<body>
<app-navbar current="${data.navbarCurrent}" />
<layout-placeholder name="body" />
</body>
</html>
<!-- /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