mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
aside with category
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# Button 按钮
|
||||
|
||||
- category: Component
|
||||
|
||||
---
|
||||
|
||||
这是一个按钮。
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Select 选择框
|
||||
|
||||
- category: Component
|
||||
|
||||
---
|
||||
|
||||
这是一个下拉选择器。
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"gh-pages-cli": "~0.2.0",
|
||||
"lodash": "~3.8.0",
|
||||
"nico": "*"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -341,7 +341,15 @@ footer ul li > a {
|
||||
height: 100%;
|
||||
background: #F9F9F9;
|
||||
position: absolute;
|
||||
padding-top: 30px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.aside-container li h4 {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
padding-left: 50px;
|
||||
margin: 10px 0;
|
||||
color: #5C6B77;
|
||||
}
|
||||
|
||||
.aside-container li a {
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
{%- set categories = resource.pages|get_all_category %}
|
||||
{%- set items = resource.pages|find_category(post.meta.category) %}
|
||||
<aside class="aside-container">
|
||||
<ul>
|
||||
{%- for item in items %}
|
||||
<li class="{%- if item.title === post.title %}current{%- endif %}">
|
||||
<a href="{{permalink_url(item)}}">{{item.title}}</a>
|
||||
{%- for category in categories %}
|
||||
<li>
|
||||
<h4>{{category}}</h4>
|
||||
<ul>
|
||||
{%- for item in items %}
|
||||
<li class="{%- if item.title === post.title %}current{%- endif %}">
|
||||
<a href="{{permalink_url(item)}}">{{item.title}}</a>
|
||||
</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</aside>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var _ = require('lodash');
|
||||
|
||||
module.exports = function(nico) {
|
||||
var exports = {};
|
||||
|
||||
@@ -10,9 +12,7 @@ module.exports = function(nico) {
|
||||
}
|
||||
if (filename === 'readme.md') {
|
||||
post.filename = post.meta.filename = 'index';
|
||||
post.meta.category = 'docs';
|
||||
}
|
||||
post.meta.category = post.meta.category || post.meta.directory;
|
||||
return post;
|
||||
};
|
||||
|
||||
@@ -37,6 +37,14 @@ module.exports = function(nico) {
|
||||
return parseInt(a, 10) - parseInt(b, 10);
|
||||
});
|
||||
return ret;
|
||||
},
|
||||
get_all_category: function(pages) {
|
||||
return _.uniq(Object.keys(pages).map(function(key) {
|
||||
var item = nico.sdk.post.read(key);
|
||||
return item.meta.category;
|
||||
}).filter(function(item) {
|
||||
return item;
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user