2019-12-23 06:49:48 +00:00
|
|
|
const { Component } = require('inferno');
|
2020-01-23 04:07:43 +00:00
|
|
|
const { cacheComponent } = require('hexo-component-inferno/lib/util/cache');
|
2019-12-23 06:49:48 +00:00
|
|
|
|
|
|
|
class Footer extends Component {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
logo,
|
|
|
|
logoUrl,
|
|
|
|
siteUrl,
|
|
|
|
siteTitle,
|
|
|
|
siteYear,
|
|
|
|
author,
|
|
|
|
links,
|
|
|
|
showVisitorCounter,
|
|
|
|
visitorCounterTitle
|
|
|
|
} = this.props;
|
|
|
|
|
2019-12-24 05:36:39 +00:00
|
|
|
return <footer class="footer">
|
|
|
|
<div class="container">
|
|
|
|
<div class="level">
|
2019-12-29 06:07:07 +00:00
|
|
|
<div class="level-start">
|
|
|
|
<a class="footer-logo is-block mb-2" href={siteUrl}>
|
2019-12-23 06:49:48 +00:00
|
|
|
{logo && logo.text ? logo.text : <img src={logoUrl} alt={siteTitle} height="28" />}
|
|
|
|
</a>
|
2019-12-29 06:07:07 +00:00
|
|
|
<p class="size-small">
|
2019-12-23 06:49:48 +00:00
|
|
|
<span dangerouslySetInnerHTML={{ __html: `© ${siteYear} ${author || siteTitle}` }}></span>
|
2019-12-29 06:07:07 +00:00
|
|
|
Powered by <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a> &
|
2019-12-23 06:49:48 +00:00
|
|
|
<a href="https://github.com/ppoffice/hexo-theme-icarus" target="_blank" rel="noopener">Icarus</a>
|
|
|
|
{showVisitorCounter ? <br /> : null}
|
|
|
|
{showVisitorCounter ? <span id="busuanzi_container_site_uv"
|
|
|
|
dangerouslySetInnerHTML={{ __html: visitorCounterTitle }}></span> : null}
|
|
|
|
</p>
|
|
|
|
</div>
|
2019-12-24 05:36:39 +00:00
|
|
|
<div class="level-end">
|
2019-12-29 06:07:07 +00:00
|
|
|
{Object.keys(links).length ? <div class="field has-addons">
|
2019-12-23 06:49:48 +00:00
|
|
|
{Object.keys(links).map(name => {
|
|
|
|
const link = links[name];
|
2019-12-24 05:36:39 +00:00
|
|
|
return <p class="control">
|
2020-01-04 05:32:07 +00:00
|
|
|
<a class={`button is-transparent ${link.icon ? 'is-large' : ''}`} target="_blank" rel="noopener" title={name} href={link.url}>
|
2019-12-24 05:36:39 +00:00
|
|
|
{link.icon ? <i class={link.icon}></i> : name}
|
2019-12-23 06:49:48 +00:00
|
|
|
</a>
|
|
|
|
</p>;
|
|
|
|
})}
|
|
|
|
</div> : null}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</footer>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = cacheComponent(Footer, 'common.footer', props => {
|
2019-12-24 05:36:39 +00:00
|
|
|
const { config, helper } = props;
|
2019-12-23 06:49:48 +00:00
|
|
|
const { url_for, _p, date } = helper;
|
|
|
|
const { logo, title, author, footer, plugins } = config;
|
|
|
|
|
|
|
|
const links = {};
|
|
|
|
if (footer && footer.links) {
|
|
|
|
Object.keys(footer.links).forEach(name => {
|
|
|
|
const link = footer.links[name];
|
|
|
|
links[name] = {
|
|
|
|
url: url_for(typeof link === 'string' ? link : link.url),
|
|
|
|
icon: link.icon
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
logo,
|
|
|
|
logoUrl: url_for(logo),
|
|
|
|
siteUrl: url_for('/'),
|
|
|
|
siteTitle: title,
|
|
|
|
siteYear: date(new Date(), 'YYYY'),
|
|
|
|
author,
|
|
|
|
links,
|
|
|
|
showVisitorCounter: plugins && plugins.busuanzi === true,
|
|
|
|
visitorCounterTitle: _p('plugin.visitor', '<span id="busuanzi_value_site_uv">0</span>')
|
|
|
|
};
|
|
|
|
});
|