Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASC-66 #10

Merged
merged 2 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import ButtonTestRoute from "@/routes/ButtonTestRoute";
import ProfilePictureTest from "./routes/ProfilePictureTestRoute";
import Test from "./routes/Test";
import SearchBarTest from "./routes/SearchBarTestRoute";
import DropdownItem from "@/components/DropdownItem";
import SortDropdownListTestRoute from "@/routes/SortDropdownListTestRoute";
import NavigationTest from "@/routes/NavigationTest";
Expand All @@ -23,6 +24,10 @@ const router = createBrowserRouter([
path: "/test",
element: <Test />,
},
{
path:"/SearchBarTestRoute",
element: <SearchBarTest />
},
{
path: "/testButton",
element: <ButtonTestRoute />,
Expand Down
34 changes: 34 additions & 0 deletions src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {useState, useRef} from "react";
import { MagnifyingGlass } from "@phosphor-icons/react";

export interface SearchBarProps {
target: string;
}


function SearchBar({ target }: SearchBarProps) {
// const input = useRef<HTMLDivElement>(null);
const [query,setQuery] = useState("")


const handleClick = () => {
//handle query
//redirect to results
console.log(query)
}

return <div className={"h-[2.5em] flex flex-row m-[1em]"}>
<input
value={query}
placeholder={"Search by " + target}
className={"p-[0.5em] rounded-l-lg border w-[20em]"}
onChange={e => setQuery(e.target.value)}
/>
<button className={"rounded-r-lg bg-primary-main p-[0.5em] hover:bg-primary-light cursor-pointer"} onClick={handleClick} >
<MagnifyingGlass color="white" size={"1em"} />
</button>
</div>;
}

export default SearchBar;

12 changes: 12 additions & 0 deletions src/routes/SearchBarTestRoute.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import SearchBar from "../components/SearchBar";

function SearchBarTest() {
return (
<div className="flex flex-col justify-center items-center min-h-screen">
<SearchBar target={"name"} />
<SearchBar target={"photo ID"} />
</div>
);
}

export default SearchBarTest;
Loading