diff --git a/components/search/Search.tsx b/components/search/Search.tsx new file mode 100644 index 0000000..2c67a34 --- /dev/null +++ b/components/search/Search.tsx @@ -0,0 +1,119 @@ +import React, { useState } from "react"; +const Search: React.FC = () => { + const [showModal, setShowModal] = useState(false); + const [searchTerm, setSearchTerm] = useState(""); + + const contents = [ + { title: "API Logic", description: "How to connect to the API Logic" }, + { title: "Versioning", description: "Common errors and how to fix them" }, + { title: "Payment Link", description: "Make payment easily in few steps" } + ]; + + const filteredContents = contents.filter(content => + searchTerm + .toLowerCase() + .split(" ") + .some(word => + content.title.toLowerCase().includes(word) || + content.description.toLowerCase().includes(word) + ) + ); + + return ( + <> + {/* search input */} +
+ +
+ + {showModal ? ( + <> +
+
+ {/* modal header */} + +
+
+ + + + + +
+ setSearchTerm(e.target.value)} /> +
+
+ {/* Modal component body */} +

Recently viewed

+ + {/* modal footer*/} +
+
+ + + +
+ + +
+ +
+
+ + + ) : null} + + ); +}; + +export default Search;