diff options
-rw-r--r-- | core/search-component/src/main/components/app/index.tsx | 11 | ||||
-rw-r--r-- | core/search-component/types/index.d.ts | 1 | ||||
-rw-r--r-- | plugins/base/build.gradle.kts | 8 | ||||
-rw-r--r-- | plugins/base/frontend/.gitignore (renamed from plugins/base/search-component/.gitignore) | 0 | ||||
-rw-r--r-- | plugins/base/frontend/build.gradle.kts (renamed from plugins/base/search-component/build.gradle.kts) | 2 | ||||
-rw-r--r-- | plugins/base/frontend/package.json (renamed from plugins/base/search-component/package.json) | 5 | ||||
-rw-r--r-- | plugins/base/frontend/postcss.config.js (renamed from plugins/base/search-component/postcss.config.js) | 0 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/components/app/index.scss (renamed from core/search-component/src/main/components/app/index.scss) | 4 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/components/app/index.tsx (renamed from plugins/base/search-component/src/main/js/search/app-root.js) | 41 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/components/root.tsx (renamed from core/search-component/src/main/components/root.tsx) | 0 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/components/search/search.tsx (renamed from core/search-component/src/main/components/search/search.tsx) | 0 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/components/search/types.ts (renamed from core/search-component/src/main/components/search/types.ts) | 0 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/scss/index.scss (renamed from core/search-component/src/main/scss/index.scss) | 0 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/types/@jetbrains/index.d.ts (renamed from core/search-component/types/@jetbrains/index.d.ts) | 0 | ||||
-rw-r--r-- | plugins/base/frontend/stylelint.config.js (renamed from plugins/base/search-component/stylelint.config.js) | 0 | ||||
-rw-r--r-- | plugins/base/frontend/tsconfig.json (renamed from core/search-component/tsconfig.json) | 8 | ||||
-rw-r--r-- | plugins/base/frontend/webpack.config.js (renamed from plugins/base/search-component/webpack.config.js) | 0 | ||||
-rw-r--r-- | settings.gradle.kts | 4 |
18 files changed, 35 insertions, 49 deletions
diff --git a/core/search-component/src/main/components/app/index.tsx b/core/search-component/src/main/components/app/index.tsx deleted file mode 100644 index 3427c1ce..00000000 --- a/core/search-component/src/main/components/app/index.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import {WithFuzzySearchFilter} from '../search/search'; -import './index.scss'; - -const App: React.FC = () => ( - <div className="search-content"> - <WithFuzzySearchFilter/> - </div> -) - -export default App diff --git a/core/search-component/types/index.d.ts b/core/search-component/types/index.d.ts deleted file mode 100644 index 80b7428f..00000000 --- a/core/search-component/types/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// <reference types="./@jetbrains" /> diff --git a/plugins/base/build.gradle.kts b/plugins/base/build.gradle.kts index 4fb8ed9f..24a7f593 100644 --- a/plugins/base/build.gradle.kts +++ b/plugins/base/build.gradle.kts @@ -10,14 +10,14 @@ dependencies { testImplementation(project(":test-tools")) } -task("copy_search", Copy::class) { - from(File(project(":plugins:base:search-component").projectDir, "dist/")) +task("copy_frontend", Copy::class) { + from(File(project(":plugins:base:frontend").projectDir, "dist/")) destinationDir = File(sourceSets.main.get().resources.sourceDirectories.singleFile, "dokka/scripts") -}.dependsOn(":plugins:base:search-component:generateSearchFiles") +}.dependsOn(":plugins:base:frontend:generateFrontendFiles") tasks { processResources { - dependsOn("copy_search") + dependsOn("copy_frontend") } } diff --git a/plugins/base/search-component/.gitignore b/plugins/base/frontend/.gitignore index 9220c11f..9220c11f 100644 --- a/plugins/base/search-component/.gitignore +++ b/plugins/base/frontend/.gitignore diff --git a/plugins/base/search-component/build.gradle.kts b/plugins/base/frontend/build.gradle.kts index 11f04ace..d1141a4c 100644 --- a/plugins/base/search-component/build.gradle.kts +++ b/plugins/base/frontend/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("com.moowork.node") version "1.3.1" } -task("generateSearchFiles") { +task("generateFrontendFiles") { dependsOn("npm_install", "npm_run_build") } diff --git a/plugins/base/search-component/package.json b/plugins/base/frontend/package.json index 1fb386f6..120d7f34 100644 --- a/plugins/base/search-component/package.json +++ b/plugins/base/frontend/package.json @@ -7,12 +7,9 @@ "dist": "./dist" }, "scripts": { - "create-component": "yo @jetbrains/ring-ui:react --path $npm_package_config_components", "build": "webpack --mode=production --devtool sourcemap", - "test": "karma start", "lint": "eslint . && npm run stylelint", - "stylelint": "stylelint --ignore-path .gitignore **/*.css", - "ci-test": "npm run lint && xvfb-maybe karma start --teamcity", + "stylelint": "stylelint --ignore-path .gitignore ./src/main/**/*.scss", "start": "webpack-dev-server -d --history-api-fallback --inline --hot --colors --port 9010" }, "babel": { diff --git a/plugins/base/search-component/postcss.config.js b/plugins/base/frontend/postcss.config.js index 66c94ee0..66c94ee0 100644 --- a/plugins/base/search-component/postcss.config.js +++ b/plugins/base/frontend/postcss.config.js diff --git a/core/search-component/src/main/components/app/index.scss b/plugins/base/frontend/src/main/components/app/index.scss index a7406115..c267bc6e 100644 --- a/core/search-component/src/main/components/app/index.scss +++ b/plugins/base/frontend/src/main/components/app/index.scss @@ -1,4 +1,4 @@ -@import "src/main/scss/index"; +@import "src/main/scss/index.scss"; html, .app-root { @@ -17,5 +17,5 @@ html, } .search-content { - margin: calc(var(--ring-unit) * 4); + padding: 24px 41px; } diff --git a/plugins/base/search-component/src/main/js/search/app-root.js b/plugins/base/frontend/src/main/components/app/index.tsx index 3544c61b..1a51e699 100644 --- a/plugins/base/search-component/src/main/js/search/app-root.js +++ b/plugins/base/frontend/src/main/components/app/index.tsx @@ -1,18 +1,19 @@ -import React, {useRef, useState, useEffect} from 'react'; -import {WithFuzzySearchFilter} from './search'; -import './app.css'; +import React, {useEffect, useRef, useState} from 'react'; +import {WithFuzzySearchFilter} from '../search/search'; +import './index.scss'; -function useComponentVisible(initialIsVisible) { +function useComponentVisible(initialIsVisible: boolean) { const [isComponentVisible, setIsComponentVisible] = useState(initialIsVisible); const ref = useRef(null); - const handleHideDropdown = (event) => { + const handleHideDropdown = (event: KeyboardEvent) => { if (event.key === "Escape") { setIsComponentVisible(false); } }; - const handleClickOutside = event => { + const handleClickOutside = (event : MouseEvent)=> { + // @ts-ignore if (ref.current && !ref.current.contains(event.target)) { setIsComponentVisible(false); } @@ -30,18 +31,20 @@ function useComponentVisible(initialIsVisible) { return { ref, isComponentVisible, setIsComponentVisible }; } -export const AppRoot = () => { - const { - ref, - isComponentVisible, - setIsComponentVisible - } = useComponentVisible(false); - - return <div ref={ref} className="search-content"> - {isComponentVisible && (<WithFuzzySearchFilter/>)} - {!isComponentVisible && ( - <span onClick={() => setIsComponentVisible(true)}> +const App: React.FC = () => { + const { + ref, + isComponentVisible, + setIsComponentVisible + } = useComponentVisible(false); + + return <div ref={ref} className="search-content"> + {isComponentVisible && (<WithFuzzySearchFilter/>)} + {!isComponentVisible && ( + <span onClick={() => setIsComponentVisible(true)}> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M19.64 18.36l-6.24-6.24a7.52 7.52 0 1 0-1.28 1.28l6.24 6.24zM7.5 13.4a5.9 5.9 0 1 1 5.9-5.9 5.91 5.91 0 0 1-5.9 5.9z"/></svg> </span>)} - </div> -}
\ No newline at end of file + </div> +} + +export default App diff --git a/core/search-component/src/main/components/root.tsx b/plugins/base/frontend/src/main/components/root.tsx index 70ed9550..70ed9550 100644 --- a/core/search-component/src/main/components/root.tsx +++ b/plugins/base/frontend/src/main/components/root.tsx diff --git a/core/search-component/src/main/components/search/search.tsx b/plugins/base/frontend/src/main/components/search/search.tsx index f0df0c98..f0df0c98 100644 --- a/core/search-component/src/main/components/search/search.tsx +++ b/plugins/base/frontend/src/main/components/search/search.tsx diff --git a/core/search-component/src/main/components/search/types.ts b/plugins/base/frontend/src/main/components/search/types.ts index 2900153a..2900153a 100644 --- a/core/search-component/src/main/components/search/types.ts +++ b/plugins/base/frontend/src/main/components/search/types.ts diff --git a/core/search-component/src/main/scss/index.scss b/plugins/base/frontend/src/main/scss/index.scss index 74af970d..74af970d 100644 --- a/core/search-component/src/main/scss/index.scss +++ b/plugins/base/frontend/src/main/scss/index.scss diff --git a/core/search-component/types/@jetbrains/index.d.ts b/plugins/base/frontend/src/main/types/@jetbrains/index.d.ts index 1dc9983c..1dc9983c 100644 --- a/core/search-component/types/@jetbrains/index.d.ts +++ b/plugins/base/frontend/src/main/types/@jetbrains/index.d.ts diff --git a/plugins/base/search-component/stylelint.config.js b/plugins/base/frontend/stylelint.config.js index 02b3f4ac..02b3f4ac 100644 --- a/plugins/base/search-component/stylelint.config.js +++ b/plugins/base/frontend/stylelint.config.js diff --git a/core/search-component/tsconfig.json b/plugins/base/frontend/tsconfig.json index 6e97c848..4cc8fd37 100644 --- a/core/search-component/tsconfig.json +++ b/plugins/base/frontend/tsconfig.json @@ -21,14 +21,10 @@ "noEmit": true, "jsx": "react", "typeRoots": [ - "./types" + "src/main/types" ] }, "include": [ - "src", - "node_modules/@types/node/globals.d.ts" - ], - "exclude": [ - "./node_modules" + "./node_modules/@types/node/globals.d.ts" ] } diff --git a/plugins/base/search-component/webpack.config.js b/plugins/base/frontend/webpack.config.js index 559f5792..559f5792 100644 --- a/plugins/base/search-component/webpack.config.js +++ b/plugins/base/frontend/webpack.config.js diff --git a/settings.gradle.kts b/settings.gradle.kts index 8e80db75..39a82007 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,7 +8,7 @@ include("runners:gradle-plugin") include("runners:cli") include("runners:maven-plugin") include("plugins:base") -include("plugins:base:search-component") +include("plugins:base:frontend") include("plugins:mathjax") include("plugins:gfm") include("plugins:jekyll") @@ -32,3 +32,5 @@ pluginManagement { gradlePluginPortal() } } +include("plugins:base:frontend") +findProject(":plugins:base:frontend")?.name = "frontend" |