Moved search components our of src/ folder. (#7869)

This commit is contained in:
Nick Taylor 2020-05-14 16:45:41 -04:00 committed by GitHub
parent 2daac8a216
commit 26cf4085fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 9 additions and 9 deletions

View file

@ -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 (

View file

@ -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);
},

View file

@ -4,7 +4,7 @@ import { Search } from '../Search';
describe('<Search />', () => {
beforeEach(() => {
global.filterXSS = x => x;
global.filterXSS = (x) => x;
});
afterEach(() => {

View file

@ -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');