hexo-theme-amane/layout/common/comment.jsx

29 lines
998 B
React
Raw Normal View History

const logger = require('hexo-log')();
2019-12-23 21:18:59 +00:00
const { Component } = require('inferno');
module.exports = class extends Component {
render() {
const { config, page, helper } = this.props;
const { __ } = helper;
const { comment } = config;
if (!comment || typeof comment.type !== 'string') {
return null;
}
return <div class="card">
<div class="card-content">
<h3 class="title is-5 has-text-weight-normal">{__('article.comments')}</h3>
2019-12-23 21:18:59 +00:00
{(() => {
try {
const Comment = require('../comment/' + comment.type);
return <Comment config={config} page={page} helper={helper} comment={comment} />;
} catch (e) {
logger.w(`Icarus cannot load comment "${comment.type}"`);
2019-12-23 21:18:59 +00:00
return null;
}
})()}
</div>
</div>;
}
};