Skip to content

Commit

Permalink
revert changes in useTranslator
Browse files Browse the repository at this point in the history
  • Loading branch information
noamilsh committed Jul 10, 2022
1 parent 72d409a commit ab423a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions components/searchBar/SearchBar.language.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"searchBarPlaceholder": "Search"
}
5 changes: 4 additions & 1 deletion components/searchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, { useCallback, ReactElement } from 'react';
import { useTranslator } from '../language/useTranslator';
import languageFile from './SearchBar.language.json';
import styles from './SearchBar.module.scss';

interface Props {
Expand All @@ -16,6 +18,7 @@ const debounce = (callback, delay) => {

const SearchBar = (props: Props): ReactElement => {
const { handelSearch, placeholder } = props;
const searchPlaceholder = useTranslator('searchBarPlaceholder', languageFile);

const debounceHandler = useCallback(debounce(handelSearch, 1000), []);

Expand All @@ -29,7 +32,7 @@ const SearchBar = (props: Props): ReactElement => {
<input
onChange={handleOnChange}
type="text"
placeholder={placeholder ? placeholder : 'Search'}
placeholder={placeholder ? placeholder : searchPlaceholder}
className={styles.textBox}
/>
<svg
Expand Down

0 comments on commit ab423a5

Please sign in to comment.