diff --git a/src/App.jsx b/src/App.jsx index 5d207d5..a5be56b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,4 +1,4 @@ -import { useEffect, useRef } from 'react' +import { useEffect, useRef, useState } from 'react' import { useDispatch } from 'react-redux' import { setQuery } from './app/searchSlice' import { setShowName } from './app/displaySlice' @@ -9,9 +9,13 @@ function App() { const inputSearch = useRef() const checkShowName = useRef() const dispatch = useDispatch() + const [currentQuery, setCurrentQuery] = useState("") function queryOnChange () { - dispatch(setQuery(inputSearch.current.value)) + let query = inputSearch.current.value + query = query.replace(/[^a-zA-Z0-9\- ]/, "") + setCurrentQuery(query) + dispatch(setQuery(query)) } function showNameOnChange () { @@ -25,7 +29,7 @@ function App() { return ( <>
- +
diff --git a/src/IconList.jsx b/src/IconList.jsx index cdecd31..59ade8b 100644 --- a/src/IconList.jsx +++ b/src/IconList.jsx @@ -36,7 +36,7 @@ export const IconList = function () { if (icons.length == 0) { return (
- No icon found for
"{query}" + No icon found for
"{query.trim().length > 24 ? query.trim().substring(0,24) + '...' : query.trim()}"
) } diff --git a/src/index.css b/src/index.css index 4c4c4ea..68b731a 100644 --- a/src/index.css +++ b/src/index.css @@ -342,6 +342,7 @@ ul.icon-list a { .no-result { text-align: center; padding: 6rem 0; + overflow-x: hidden; } @media (hover:hover) {