From 16da793f457fb66051d47b773b8f42be6b900f18 Mon Sep 17 00:00:00 2001 From: MattLeo Date: Tue, 25 Nov 2025 13:00:31 -0600 Subject: [PATCH] built search bar component --- client/kb-frontend/src/App.jsx | 3 +- .../kb-frontend/src/components/SearchBar.jsx | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/client/kb-frontend/src/App.jsx b/client/kb-frontend/src/App.jsx index 2d91765..7f7a81d 100644 --- a/client/kb-frontend/src/App.jsx +++ b/client/kb-frontend/src/App.jsx @@ -1,6 +1,7 @@ import { useState, useEffect } from 'react' import './App.css' import Header from './components/Header' +import SearchBar from './SearchBar' function App() { const [currentView, setCurrentView] = useState('list'); @@ -42,7 +43,7 @@ function App() { {currentView === 'list' ? ( <> - {/**/} + {/**/} ) : ( diff --git a/client/kb-frontend/src/components/SearchBar.jsx b/client/kb-frontend/src/components/SearchBar.jsx index e69de29..98c5d55 100644 --- a/client/kb-frontend/src/components/SearchBar.jsx +++ b/client/kb-frontend/src/components/SearchBar.jsx @@ -0,0 +1,35 @@ +//import 'SearchBar.css' +import { useState } from 'react' + +function SearchBar({ onSearch }) { + const [query, setQuery] = useState(''); + + const handleSearch = (e) => { + e.preventDefault(); + onSearch(query); + }; + + return ( +
+
+ setQuery(e.target.value)} + + /* USer this for instant search + onChange={(e) => { + setQuery(e.target.value); + onSearch(e.target.value); + }} + */ + + /> + +
+
+ ); +} + +export default SearchBar \ No newline at end of file