2019-06-11 17:00:02 +08:00
|
|
|
import React from 'react';
|
2019-06-04 16:24:09 +08:00
|
|
|
import makeSchemaRenderer from './SchemaRender';
|
|
|
|
|
|
|
|
const FormComponent = makeSchemaRenderer({
|
2019-11-07 10:41:14 +08:00
|
|
|
type: 'form',
|
|
|
|
mode: 'inline',
|
|
|
|
wrapWithPanel: false,
|
2020-07-28 10:03:53 +08:00
|
|
|
className: ':Doc-search',
|
2019-11-07 10:41:14 +08:00
|
|
|
controls: [
|
|
|
|
{
|
|
|
|
type: 'input-group',
|
|
|
|
size: 'sm',
|
|
|
|
controls: [
|
|
|
|
{
|
|
|
|
type: 'icon',
|
2020-07-23 20:31:51 +08:00
|
|
|
addOnclassName: 'no-bg no-border p-r-none p-l',
|
2019-11-07 10:41:14 +08:00
|
|
|
className: 'text-sm',
|
|
|
|
icon: 'search',
|
|
|
|
vendor: 'iconfont'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'text',
|
2020-07-23 20:31:51 +08:00
|
|
|
placeholder: '搜索...',
|
|
|
|
inputClassName: 'no-border',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'docsearch'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|
2019-06-04 16:24:09 +08:00
|
|
|
|
|
|
|
export default class DocSearch extends React.Component {
|
2019-11-07 10:41:14 +08:00
|
|
|
componentDidMount() {
|
|
|
|
const inputSelector = 'input[name="docsearch"]';
|
|
|
|
docsearch({
|
2020-08-06 14:57:13 +08:00
|
|
|
appId: 'S08MJHBHFJ',
|
2020-08-07 16:20:17 +08:00
|
|
|
apiKey: '5fba814bb773d08b5d2a3f6074f926a5',
|
2019-11-07 10:41:14 +08:00
|
|
|
indexName: 'gh_pages',
|
|
|
|
inputSelector,
|
|
|
|
debug: false
|
|
|
|
});
|
|
|
|
}
|
2019-06-04 16:24:09 +08:00
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
render() {
|
|
|
|
return <FormComponent showCode={false} theme={this.props.theme} />;
|
|
|
|
}
|
|
|
|
}
|