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

21 lines
620 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 { share } = config;
if (!share || typeof share.type !== 'string') {
return null;
}
try {
const Share = require('../share/' + share.type);
return <Share config={config} page={page} helper={helper} share={share} />;
} catch (e) {
logger.w(`Icarus cannot load share button "${share.type}"`);
2019-12-23 21:18:59 +00:00
return null;
}
}
};