-
-
-
-
-
- <%= post.title %>
-
-
- diff --git a/layout/archive.ejs b/layout/archive.ejs deleted file mode 100644 index ace6b41..0000000 --- a/layout/archive.ejs +++ /dev/null @@ -1,56 +0,0 @@ -<% function buildArchive(posts, year, month = null) { - const time = moment([page.year, page.month ? page.month - 1 : null].filter(i => i !== null)); %> -
-<% } -if (!page.year) { - let years = {}; - page.posts.each(p => years[p.date.year()] = null); - for (let year of Object.keys(years).sort((a, b) => b - a)) { - let posts = page.posts.filter(p => p.date.year() == year); %> - <%- buildArchive(posts, year, null) %> - <% } -} else { %> -<%- buildArchive(page.posts, page.year, page.month) %> -<% } %> -<% if (page.total > 1) { %> - <%- _partial('common/paginator') %> -<% } %> \ No newline at end of file diff --git a/layout/archive.jsx b/layout/archive.jsx new file mode 100644 index 0000000..ddca928 --- /dev/null +++ b/layout/archive.jsx @@ -0,0 +1,84 @@ +'use strict'; + +const moment = require('moment'); +const { Component, Fragment } = require('inferno'); +const Paginator = require('./misc/paginator'); + +module.exports = class extends Component { + render() { + const { page } = this.props; + // TODO + const helper = {}; + const config = {}; + const { url_for, __, has_thumbnail, get_thumbnail, date_xml, date } = helper; + + const language = page.lang || page.language || config.language; + + function renderArticleList(posts, year, month = null) { + const time = moment([page.year, page.month ? page.month - 1 : null].filter(i => i !== null)); + + return ; + } + + let articleList; + if (!page.year) { + const years = {}; + page.posts.each(p => years[p.date.year()] = null); + articleList = Object.keys(years).sort((a, b) => b - a).map(year => { + let posts = page.posts.filter(p => p.date.year() == year); + return renderArticleList(posts, year, null); + }); + } else { + articleList = renderArticleList(page.posts, page.year, page.month); + } + + return