From 26cf4085fc9ae301eeda67a368abda5273c501ec Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 14 May 2020 16:45:41 -0400 Subject: [PATCH] Moved search components our of src/ folder. (#7869) --- app/javascript/{src/components => }/Search/Search.jsx | 10 +++++----- .../{src/components => }/Search/SearchForm.jsx | 0 .../Search/__stories__/SearchForm.stories.jsx | 2 +- .../components => }/Search/__tests__/Search.test.jsx | 2 +- .../Search/__tests__/SearchForm.test.jsx | 0 .../__tests__/__snapshots__/Search.test.jsx.snap | 0 .../__tests__/__snapshots__/SearchForm.test.jsx.snap | 0 app/javascript/{src/components => }/Search/index.js | 0 app/javascript/packs/Search.jsx | 4 ++-- 9 files changed, 9 insertions(+), 9 deletions(-) rename app/javascript/{src/components => }/Search/Search.jsx (95%) rename app/javascript/{src/components => }/Search/SearchForm.jsx (100%) rename app/javascript/{src/components => }/Search/__stories__/SearchForm.stories.jsx (95%) rename app/javascript/{src/components => }/Search/__tests__/Search.test.jsx (91%) rename app/javascript/{src/components => }/Search/__tests__/SearchForm.test.jsx (100%) rename app/javascript/{src/components => }/Search/__tests__/__snapshots__/Search.test.jsx.snap (100%) rename app/javascript/{src/components => }/Search/__tests__/__snapshots__/SearchForm.test.jsx.snap (100%) rename app/javascript/{src/components => }/Search/index.js (100%) diff --git a/app/javascript/src/components/Search/Search.jsx b/app/javascript/Search/Search.jsx similarity index 95% rename from app/javascript/src/components/Search/Search.jsx rename to app/javascript/Search/Search.jsx index a654a3543..19e8c6874 100644 --- a/app/javascript/src/components/Search/Search.jsx +++ b/app/javascript/Search/Search.jsx @@ -6,7 +6,7 @@ import { hasInstantClick, preloadSearchResults, displaySearchResults, -} from '../../utils/search'; +} from '../src/utils/search'; import { SearchForm } from './SearchForm'; const GLOBAL_MINIMIZE_KEY = '0'; @@ -57,11 +57,11 @@ export class Search extends Component { this.enableSearchPageChecker = true; }; - hasKeyModifiers = event => { + hasKeyModifiers = (event) => { return event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; }; - search = event => { + search = (event) => { const { key, target: { value }, @@ -77,7 +77,7 @@ export class Search extends Component { } }; - submit = event => { + submit = (event) => { if (hasInstantClick) { event.preventDefault(); @@ -95,7 +95,7 @@ export class Search extends Component { const { searchBoxId } = this.props; const searchBox = document.getElementById(searchBoxId); - this.globalKeysListener = event => { + this.globalKeysListener = (event) => { const { tagName, classList } = document.activeElement; if ( diff --git a/app/javascript/src/components/Search/SearchForm.jsx b/app/javascript/Search/SearchForm.jsx similarity index 100% rename from app/javascript/src/components/Search/SearchForm.jsx rename to app/javascript/Search/SearchForm.jsx diff --git a/app/javascript/src/components/Search/__stories__/SearchForm.stories.jsx b/app/javascript/Search/__stories__/SearchForm.stories.jsx similarity index 95% rename from app/javascript/src/components/Search/__stories__/SearchForm.stories.jsx rename to app/javascript/Search/__stories__/SearchForm.stories.jsx index d8f27a092..da7bb41f2 100644 --- a/app/javascript/src/components/Search/__stories__/SearchForm.stories.jsx +++ b/app/javascript/Search/__stories__/SearchForm.stories.jsx @@ -6,7 +6,7 @@ import { SearchForm } from '..'; const commonProps = { searchBoxId: 'nav-search', onSearch: action('on preloading search'), - onSubmitSearch: e => { + onSubmitSearch: (e) => { e.preventDefault(); action('on submit')(e); }, diff --git a/app/javascript/src/components/Search/__tests__/Search.test.jsx b/app/javascript/Search/__tests__/Search.test.jsx similarity index 91% rename from app/javascript/src/components/Search/__tests__/Search.test.jsx rename to app/javascript/Search/__tests__/Search.test.jsx index 055917b56..b44dd7b4f 100644 --- a/app/javascript/src/components/Search/__tests__/Search.test.jsx +++ b/app/javascript/Search/__tests__/Search.test.jsx @@ -4,7 +4,7 @@ import { Search } from '../Search'; describe('', () => { beforeEach(() => { - global.filterXSS = x => x; + global.filterXSS = (x) => x; }); afterEach(() => { diff --git a/app/javascript/src/components/Search/__tests__/SearchForm.test.jsx b/app/javascript/Search/__tests__/SearchForm.test.jsx similarity index 100% rename from app/javascript/src/components/Search/__tests__/SearchForm.test.jsx rename to app/javascript/Search/__tests__/SearchForm.test.jsx diff --git a/app/javascript/src/components/Search/__tests__/__snapshots__/Search.test.jsx.snap b/app/javascript/Search/__tests__/__snapshots__/Search.test.jsx.snap similarity index 100% rename from app/javascript/src/components/Search/__tests__/__snapshots__/Search.test.jsx.snap rename to app/javascript/Search/__tests__/__snapshots__/Search.test.jsx.snap diff --git a/app/javascript/src/components/Search/__tests__/__snapshots__/SearchForm.test.jsx.snap b/app/javascript/Search/__tests__/__snapshots__/SearchForm.test.jsx.snap similarity index 100% rename from app/javascript/src/components/Search/__tests__/__snapshots__/SearchForm.test.jsx.snap rename to app/javascript/Search/__tests__/__snapshots__/SearchForm.test.jsx.snap diff --git a/app/javascript/src/components/Search/index.js b/app/javascript/Search/index.js similarity index 100% rename from app/javascript/src/components/Search/index.js rename to app/javascript/Search/index.js diff --git a/app/javascript/packs/Search.jsx b/app/javascript/packs/Search.jsx index 0ea6db6eb..0a076a0e9 100644 --- a/app/javascript/packs/Search.jsx +++ b/app/javascript/packs/Search.jsx @@ -1,6 +1,6 @@ import { h, render } from 'preact'; -import { Search } from '../src/components/Search'; -import 'focus-visible' +import { Search } from '../Search'; +import 'focus-visible'; document.addEventListener('DOMContentLoaded', () => { const root = document.getElementById('top-bar--search');