diff --git a/src/components/atoms/Dropdown/index.tsx b/src/components/atoms/Dropdown/index.tsx index 0bfdfc9..66fd7b4 100644 --- a/src/components/atoms/Dropdown/index.tsx +++ b/src/components/atoms/Dropdown/index.tsx @@ -1,5 +1,6 @@ "use client"; -import { FC, useEffect, useState } from "react"; +import { useOutsideClick } from "@/hooks/useOutsideClick"; +import { FC, useEffect, useRef, useState } from "react"; import { FaFilter } from "react-icons/fa"; type Props = { @@ -12,19 +13,31 @@ type Props = { }; export const Dropdown: FC = ({ items, defaultValue, callback }) => { + const ref = useRef(null); + const [isOpen, setIsOpen] = useState(false); const [value, setValue] = useState(defaultValue); + useOutsideClick(ref, () => setIsOpen(false)); + useEffect(() => { callback?.(value); }, [value]); return ( -
- -
+
{items.map((item) => (

= ({ layout = "default", ...movie }) => {

diff --git a/src/components/molecules/SearchMovies/index.tsx b/src/components/molecules/SearchMovies/index.tsx index 7adc89d..aa08e91 100644 --- a/src/components/molecules/SearchMovies/index.tsx +++ b/src/components/molecules/SearchMovies/index.tsx @@ -6,6 +6,7 @@ import { SearchResult } from "@/lib/tmdb/types"; import { FC } from "react"; import { useEffect } from "react"; import { Pagination } from "@/components/atoms/Pagination"; +import { MovieList } from "../MovieList"; type Props = { query: string; @@ -44,18 +45,16 @@ export const SearchList: FC = ({ query }) => {

{total_results} movies found for your search

-
- {results?.map((result) => ( - - ))} -
+ + ({ + ...m, + favorite: false, + seen: false, + genre_ids: JSON.stringify(m.genre_ids), + }))} + fluid + />