2019-12-24 05:36:39 +00:00
|
|
|
const logger = require('hexo-log')();
|
2019-12-23 22:11:22 +00:00
|
|
|
const { Component } = require('inferno');
|
2020-01-23 04:07:43 +00:00
|
|
|
const view = require('hexo-component-inferno/lib/core/view');
|
2019-12-23 22:11:22 +00:00
|
|
|
|
|
|
|
module.exports = class extends Component {
|
|
|
|
render() {
|
|
|
|
const { config, helper } = this.props;
|
|
|
|
const { search } = config;
|
|
|
|
if (!search || typeof search.type !== 'string') {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2020-01-23 04:07:43 +00:00
|
|
|
const Search = view.require('search/' + search.type);
|
2019-12-23 22:11:22 +00:00
|
|
|
return <Search config={config} helper={helper} search={search} />;
|
|
|
|
} catch (e) {
|
2019-12-24 05:36:39 +00:00
|
|
|
logger.w(`Icarus cannot load search "${search.type}"`);
|
2019-12-23 22:11:22 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|