diff options
author | Maksymilian Pamula <mpamula@virtuslab.com> | 2020-04-22 06:46:36 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-06-04 11:25:34 +0200 |
commit | 4065a65fe3294e0ddf54f5756380f7dc1aa032b2 (patch) | |
tree | 3f225828db0430f478f1db9650c9c2d858d6bfa8 /plugins/base/search-component/src/main/js | |
parent | 7674ce23f132f727b71545ad3aa62be5059613d6 (diff) | |
download | dokka-4065a65fe3294e0ddf54f5756380f7dc1aa032b2.tar.gz dokka-4065a65fe3294e0ddf54f5756380f7dc1aa032b2.tar.bz2 dokka-4065a65fe3294e0ddf54f5756380f7dc1aa032b2.zip |
TD: Rewrite application to TS
Diffstat (limited to 'plugins/base/search-component/src/main/js')
3 files changed, 0 insertions, 114 deletions
diff --git a/plugins/base/search-component/src/main/js/search/app.css b/plugins/base/search-component/src/main/js/search/app.css deleted file mode 100644 index c51d3fe1..00000000 --- a/plugins/base/search-component/src/main/js/search/app.css +++ /dev/null @@ -1,21 +0,0 @@ -@import "@jetbrains/ring-ui/components/global/variables.css"; - -html, -.app-root { - height: 100%; -} - -.search-root { - margin: 0; - padding: 0; - - background: var(--ring-content-background-color); - - font-family: var(--ring-font-family); - font-size: var(--ring-font-size); - line-height: var(--ring-line-height); -} - -.search-content { - padding: 24px 41px; -} diff --git a/plugins/base/search-component/src/main/js/search/app.js b/plugins/base/search-component/src/main/js/search/app.js deleted file mode 100644 index bceffa48..00000000 --- a/plugins/base/search-component/src/main/js/search/app.js +++ /dev/null @@ -1,41 +0,0 @@ -import React from 'react'; -import {render} from 'react-dom'; -import RedBox from 'redbox-react'; - -import {AppRoot} from './app-root'; -import './app.css'; - -const appEl = document.getElementById('searchBar'); -const rootEl = document.createElement('div'); - -let renderApp = () => { - render( - <AppRoot/>, - rootEl - ); -}; - -if (module.hot) { - const renderAppHot = renderApp; - const renderError = error => { - render( - <RedBox error={error}/>, - rootEl - ); - }; - - renderApp = () => { - try { - renderAppHot(); - } catch (error) { - renderError(error); - } - }; - - module.hot.accept('./app-root', () => { - setTimeout(renderApp); - }); -} - -renderApp(); -appEl.appendChild(rootEl); diff --git a/plugins/base/search-component/src/main/js/search/search.js b/plugins/base/search-component/src/main/js/search/search.js deleted file mode 100644 index a742f11d..00000000 --- a/plugins/base/search-component/src/main/js/search/search.js +++ /dev/null @@ -1,52 +0,0 @@ -import React, {Component} from 'react'; -import Select from '@jetbrains/ring-ui/components/select/select'; -import '@jetbrains/ring-ui/components/input-size/input-size.scss'; - -class WithFuzzySearchFilterComponent extends Component { - constructor(props) { - super(props); - this.state = {selected: props.data[0]}; - } - - clearSelection = () => { - this.setState({selected: null}); - }; - - onSelect = option => { - window.location.href = `${window.pathToRoot}${option.location}?query${option.name}`; - this.setState({selected: option}); - debugger - }; - - render() { - return ( - <div className="search-container"> - <div className="search"> - <Select - selectedLabel="Search" - label="Please type page name" - filter={{fuzzy: true}} - clear - selected={this.state.selected} - data={this.props.data} - onSelect={this.onSelect} - /> - </div> - </div> - ); - } -} - -export const WithFuzzySearchFilter = () => { - let data = []; - if (window.pages) { - data = window.pages.map((page, i) => ({ - ...page, - label: page.name, - key: i + 1, - type: page.kind - })); - } - - return <WithFuzzySearchFilterComponent data={data}/>; -}; |