From 25d826bb75a78eb674a63aed19f55e92d7ff8bca Mon Sep 17 00:00:00 2001 From: Filip ZybaƂa Date: Tue, 12 May 2020 14:58:05 +0200 Subject: Migrated resources to base-plugin --- .../src/main/js/search/app-root.js | 47 ------------------- core/search-component/src/main/js/search/app.css | 21 --------- core/search-component/src/main/js/search/app.js | 41 ----------------- core/search-component/src/main/js/search/search.js | 52 ---------------------- 4 files changed, 161 deletions(-) delete mode 100644 core/search-component/src/main/js/search/app-root.js delete mode 100644 core/search-component/src/main/js/search/app.css delete mode 100644 core/search-component/src/main/js/search/app.js delete mode 100644 core/search-component/src/main/js/search/search.js (limited to 'core/search-component/src/main') diff --git a/core/search-component/src/main/js/search/app-root.js b/core/search-component/src/main/js/search/app-root.js deleted file mode 100644 index 5d650581..00000000 --- a/core/search-component/src/main/js/search/app-root.js +++ /dev/null @@ -1,47 +0,0 @@ -import React, {useRef, useState, useEffect} from 'react'; -import {WithFuzzySearchFilter} from './search'; -import './app.css'; - -function useComponentVisible(initialIsVisible) { - const [isComponentVisible, setIsComponentVisible] = useState(initialIsVisible); - const ref = useRef(null); - - const handleHideDropdown = (event) => { - if (event.key === "Escape") { - setIsComponentVisible(false); - } - }; - - const handleClickOutside = event => { - if (ref.current && !ref.current.contains(event.target)) { - setIsComponentVisible(false); - } - }; - - useEffect(() => { - document.addEventListener("keydown", handleHideDropdown, true); - document.addEventListener("click", handleClickOutside, true); - return () => { - document.removeEventListener("keydown", handleHideDropdown, true); - document.removeEventListener("click", handleClickOutside, true); - }; - }); - - return { ref, isComponentVisible, setIsComponentVisible }; -} - -export const AppRoot = () => { - const { - ref, - isComponentVisible, - setIsComponentVisible - } = useComponentVisible(false); - - return
- {isComponentVisible && ()} - {!isComponentVisible && ( - setIsComponentVisible(true)}> - - )} -
-} \ No newline at end of file diff --git a/core/search-component/src/main/js/search/app.css b/core/search-component/src/main/js/search/app.css deleted file mode 100644 index c51d3fe1..00000000 --- a/core/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/core/search-component/src/main/js/search/app.js b/core/search-component/src/main/js/search/app.js deleted file mode 100644 index bceffa48..00000000 --- a/core/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( - , - rootEl - ); -}; - -if (module.hot) { - const renderAppHot = renderApp; - const renderError = error => { - render( - , - rootEl - ); - }; - - renderApp = () => { - try { - renderAppHot(); - } catch (error) { - renderError(error); - } - }; - - module.hot.accept('./app-root', () => { - setTimeout(renderApp); - }); -} - -renderApp(); -appEl.appendChild(rootEl); diff --git a/core/search-component/src/main/js/search/search.js b/core/search-component/src/main/js/search/search.js deleted file mode 100644 index a742f11d..00000000 --- a/core/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 ( -
-
-