From b8d6e7da8d888bde07111fd586eac6c401ddd2de Mon Sep 17 00:00:00 2001 From: Shiva Date: Fri, 2 Jun 2023 00:03:02 +0530 Subject: [PATCH] Improved added onclick search and removed on change search to reduce no of request to the server --- public/index.html | 34 ++++++++++++++++++++++------------ public/robot.txt | 2 ++ src/Components/Header.jsx | 13 ++++++++++++- src/Components/SearchJSX.jsx | 10 +++++++--- src/Pages/movie.jsx | 2 +- src/Pages/topAiring.jsx | 6 +++--- src/css/card.css | 2 +- src/css/navbar.css | 24 ++++++++++++++++++++++-- 8 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 public/robot.txt diff --git a/public/index.html b/public/index.html index faae40c8..cd701b0e 100644 --- a/public/index.html +++ b/public/index.html @@ -5,7 +5,8 @@ - + @@ -13,7 +14,8 @@ - + - - - - - + + + + + + + + + + + + + - - - - - Watch Download Anime For Free On AnimeTrix diff --git a/public/robot.txt b/public/robot.txt new file mode 100644 index 00000000..6f27bb66 --- /dev/null +++ b/public/robot.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: \ No newline at end of file diff --git a/src/Components/Header.jsx b/src/Components/Header.jsx index ede37dbd..abfa5b79 100644 --- a/src/Components/Header.jsx +++ b/src/Components/Header.jsx @@ -98,9 +98,13 @@ const Header = forwardRef((props, ref) => { const handelChange = (e) => { const val = e.target.value; setInputVal(val); - props.handelChanges(val); }; + + const handleSearchSubmit = () => { + props.handelChanges(inputVal); + } + useImperativeHandle(ref, () => ({ emptySearch() { setInputVal(""); @@ -177,7 +181,11 @@ const Header = forwardRef((props, ref) => { placeholder="I am looking for...." value={inputVal} onChange={handelChange} + required /> + {!isLoggedIn ?
  • @@ -207,6 +215,9 @@ const Header = forwardRef((props, ref) => {
    +
    diff --git a/src/Components/SearchJSX.jsx b/src/Components/SearchJSX.jsx index 17e407d9..a5bc5f96 100644 --- a/src/Components/SearchJSX.jsx +++ b/src/Components/SearchJSX.jsx @@ -13,15 +13,19 @@ export default function SearchJSX(props) { {Object.keys(props.searchResult).length === 0 ? (

    No Results found



    ) : (
    + { + window.innerWidth > 600 ? null :<>


    + } +
    - {props.searchResult?.results?.map((rec) => ( - + {props.searchResult?.results?.map((rec) => ( + ))}
    diff --git a/src/Pages/movie.jsx b/src/Pages/movie.jsx index 621a1db3..046ef532 100644 --- a/src/Pages/movie.jsx +++ b/src/Pages/movie.jsx @@ -41,7 +41,7 @@ const Movie = (props) => {
    -

    Anime Movies

    +

    Movies

    diff --git a/src/Pages/topAiring.jsx b/src/Pages/topAiring.jsx index bb3b73cb..c3de1c7b 100644 --- a/src/Pages/topAiring.jsx +++ b/src/Pages/topAiring.jsx @@ -21,7 +21,7 @@ const TopAnimeAiring = (props) => { return ( <> - + @@ -36,13 +36,13 @@ const TopAnimeAiring = (props) => { Watch Download Anime For Free On AnimeTrix {Object.keys(props.recent).length === 0 ? ( - + ) : ( <>
    -

    Top-Airing

    +

    Trending

    diff --git a/src/css/card.css b/src/css/card.css index bd01a5d3..857f026c 100644 --- a/src/css/card.css +++ b/src/css/card.css @@ -114,7 +114,7 @@ } } -@media(max-width:535px){ +@media(max-width:550px){ .card-head{ height: 300px; } diff --git a/src/css/navbar.css b/src/css/navbar.css index cf55fcdf..db1e7e30 100644 --- a/src/css/navbar.css +++ b/src/css/navbar.css @@ -72,7 +72,28 @@ color: var(--text-color); width: 300px; } - +.search-submit{ + background: transparent; + padding: 2px; + color: var(--button-color); + position: absolute; + left: 86%; + font-size: 20px; + top: calc(35% - 10px);; + bottom: 20px; +} +.search-submit-mobile{ + display: none; +} +.search-submit-mobile.active{ + display: block; + position: absolute; + bottom: calc(90% - 139px); + right: 16%; + font-size: 25px; + background: transparent; + z-index: 999; +} .search-btn { background: none; border: none; @@ -270,7 +291,6 @@ left: 0; right: 0; margin: auto; - z-index: 9999; border-radius: 14px; background-color: var(--search-background); color: #fff;