Skip to content

Commit

Permalink
hierarchical nav
Browse files Browse the repository at this point in the history
  • Loading branch information
zeke committed Sep 3, 2014
1 parent f20f32f commit 031f625
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ npm install
npm start
```

If you add or rename pages, add them to [_data.json](/_data.json) so they'll
show up in the sidebar.

Open [localhost:9000](https://localhost:9000)

## Deployment
Expand Down
23 changes: 18 additions & 5 deletions _data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,26 @@
"index": {
"title": "Installing npme"
},
"publish": {
"title": "Publishing a Module"
},
"scoped-modules": {
"title": "Scoped Modules"
"title": "Scoped Modules",
"subpages": {
"deux": {
"title": "Start Scoping"
},
"trois": {
"title": "Finish Scoping"
}
}
},
"enterprise": {
"title": "Enterprise"
"title": "Enterprise",
"subpages": {
"foo": {
"title": "Always be Enterprising"
},
"trois": {
"title": "Fin"
}
}
}
}
5 changes: 4 additions & 1 deletion _layout.jade
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ html
nav
h2 Contents
for doc, slug in public._data
a(href="/#{slug}" class=(current.source === slug ? "active" : ""))= doc.title
a(href="/#{slug}" class=(current.path[0] === slug ? "active" : ""))= doc.title
if doc.subpages
for subpage, subslug in doc.subpages
a.subpage(href="/#{slug}/#{subslug}" class=(current.source === subslug && current.path[0] === slug ? "active" : ""))= subpage.title

section
!= yield
Expand Down
1 change: 1 addition & 0 deletions enterprise/foo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Foo
File renamed without changes.
1 change: 1 addition & 0 deletions enterprise/trois.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Enterprise Trois
Empty file added scoped-modules/deux.md
Empty file.
File renamed without changes.
1 change: 1 addition & 0 deletions scoped-modules/trois.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Scoped Trois
14 changes: 14 additions & 0 deletions styles/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ fonts = 'Source Sans Pro', 'Lucida Grande', sans-serif
codefonts = 'Source Code Pro', 'Courier', sans-serif

npmred = #cb3837
subpage-link-color = #999
subpage-link-color-active = #333

sectionWidth = 600px
navWidth = 200px
Expand All @@ -16,6 +18,7 @@ body
color #333
margin 0
padding 0
font-size 16px

a
color npmred
Expand Down Expand Up @@ -66,6 +69,17 @@ nav
&.active, &:hover
border-left 3px solid npmred
color rgba(npmred, 1)
&.subpage
color subpage-link-color
border-left-color transparent
padding-left 20px
font-size 14px
// &:before
// content: "\2022"
// padding-right 6px
&:hover, &.active
color: subpage-link-color-active
border-left-color subpage-link-color


@media only screen and (max-width: navWidth + sectionWidth)
Expand Down

0 comments on commit 031f625

Please sign in to comment.