diff --git a/compass/app/home/page.tsx b/compass/app/home/page.tsx index b50bbd6..c656fd4 100644 --- a/compass/app/home/page.tsx +++ b/compass/app/home/page.tsx @@ -2,6 +2,7 @@ import Callout from "@/components/resource/Callout"; import Card from "@/components/resource/Card"; import { LandingSearchBar } from "@/components/resource/LandingSearchBar"; +import { SearchResult } from "@/components/resource/SearchResult"; import Image from "next/image"; import Link from "next/link"; @@ -13,6 +14,7 @@ export default function Page() { Good evening! + ); diff --git a/compass/components/resource/LandingSearchBar.tsx b/compass/components/resource/LandingSearchBar.tsx index e3f8600..7331d41 100644 --- a/compass/components/resource/LandingSearchBar.tsx +++ b/compass/components/resource/LandingSearchBar.tsx @@ -15,7 +15,10 @@ import React, { useEffect, } from "react"; import Image from "next/image"; -import { FilterBox } from "../FilterBox"; +import { SearchResult } from "./SearchResult"; + +// TODO: Actually implement search. +import sampleResults from "./sample_results.json"; export const LandingSearchBar: React.FC = () => { const [searchTerm, setSearchTerm] = useState(""); @@ -111,7 +114,12 @@ export const LandingSearchBar: React.FC = () => { {/* search results, for now since it's empty this is the default screen */} -
+
0 ? " hidden" : "") + } + > Landing illustration { results.

+ +
0 ? "" : " hidden") + } + > + {sampleResults.map((result, i) => ( + + ))} +
); }; @@ -147,6 +171,7 @@ const useFilterPillDropdown = ( }, [ref, setShowDropdown]); }; +// Props for the filter pill... interface FilterPillProps { icon: React.ForwardRefExoticComponent< Omit, "ref"> @@ -158,6 +183,7 @@ interface FilterPillProps { setSelectedOptions: React.Dispatch>; } +// The filter pill (visible when filter button active, contains dropdown) const FilterPill: React.FC = ({ icon, name, diff --git a/compass/components/resource/SearchResult.tsx b/compass/components/resource/SearchResult.tsx new file mode 100644 index 0000000..42b1b9e --- /dev/null +++ b/compass/components/resource/SearchResult.tsx @@ -0,0 +1,44 @@ +import React from "react"; +import { + BookmarkIcon, + ClipboardIcon, + QuestionMarkCircleIcon, + ArrowUturnRightIcon, +} from "@heroicons/react/24/solid"; + +interface SearchResultProps { + type: "resource" | "service" | string; + name: string; + description: string; +} + +export const SearchResult: React.FC = ({ + type, + name, + description, +}) => { + const Icon: React.ForwardRefExoticComponent< + Omit, "ref"> + > = + type === "resource" + ? BookmarkIcon + : type === "service" + ? ClipboardIcon + : QuestionMarkCircleIcon; // Unknown type + + return ( +
+ {/* Left side of the item */} +
+ + + {name} + + + {description} + +
+ +
+ ); +}; diff --git a/compass/components/resource/sample_results.json b/compass/components/resource/sample_results.json new file mode 100644 index 0000000..275250c --- /dev/null +++ b/compass/components/resource/sample_results.json @@ -0,0 +1,32 @@ +[ + { + "type": "resource", + "name": "example name", + "description": "example description" + }, + { + "type": "service", + "name": "example name", + "description": "example description" + }, + { + "type": "resource", + "name": "National Domestic Violence Hotline", + "description": "24/7 confidential support for victims of domestic violence" + }, + { + "type": "resource", + "name": "Legal Aid Society", + "description": "Free legal assistance for low-income individuals" + }, + { + "type": "service", + "name": "Crisis Hotline", + "description": "24/7 support for individuals in crisis" + }, + { + "type": "unknown", + "name": "unknown thing with a really long name", + "description": "and let's also type out a really long description to see how it handles overflow and all that anyways" + } +]