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

21 lines
598 B
React
Raw Normal View History

2019-12-22 17:16:19 +00:00
const { Component } = require('inferno');
const { cacheComponent } = require('hexo-component-inferno/lib/util/cache');
2019-12-22 17:16:19 +00:00
class AnimeJs extends Component {
render() {
if (this.props.head) {
return <style dangerouslySetInnerHTML={{ __html: 'body>.footer,body>.navbar,body>.section{opacity:0}' }}></style>;
}
return <script src={this.props.jsUrl}></script>;
2019-12-22 17:16:19 +00:00
}
}
module.exports = cacheComponent(AnimeJs, 'plugin.animejs', props => {
const { helper, head } = props;
2019-12-22 17:16:19 +00:00
return {
head,
jsUrl: helper.url_for('/js/animation.js')
2019-12-22 17:16:19 +00:00
};
});