hexo-theme-amane/layout/plugin/progressbar.jsx

27 lines
673 B
React
Raw Normal View History

2019-12-22 17:16:19 +00:00
'use strict';
const { Component, Fragment } = require('inferno');
const { cacheComponent } = require('../util/cache');
class ProgressBar extends Component {
render() {
const { url_for, jsUrl } = this.props;
2019-12-22 17:16:19 +00:00
return <Fragment>
<link rel="stylesheet" href={url_for('/css/progressbar.css')} />
<script src={jsUrl}></script>
2019-12-22 17:16:19 +00:00
</Fragment>;
}
}
module.exports = cacheComponent(ProgressBar, 'plugin.progressbar', props => {
const { head, helper } = props;
if (!head) {
2019-12-22 17:16:19 +00:00
return null;
}
return {
url_for: helper.url_for,
jsUrl: helper.cdn('pace-js', '1.0.2', 'pace.min.js')
2019-12-22 17:16:19 +00:00
};
});