Skip to content

Commit

Permalink
feat: handle colon in UCLA categories
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinWu098 committed Apr 5, 2024
1 parent eaa72ff commit c22317b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
13 changes: 12 additions & 1 deletion components/search/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,18 @@ const SearchResults = (props: SearchResultsProps) => {
</div>
<div className="flex flex-row gap-2 text-base font-light">
{result.fulfillsGEs
.map((obj) => obj.category)
.map((obj) => {
const category =
obj.category;

return category.includes(
":",
)
? category.split(
": ",
)[1]
: category;
})
.join(", ")}
</div>
</div>
Expand Down
30 changes: 22 additions & 8 deletions components/search/SearchSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,31 @@ export const SearchSelect = (props: DropdownComponentProps) => {
return (
<div className="relative flex h-12 w-[300px] md:h-16">
<Select value={value} onValueChange={onChange}>
<SelectTrigger className="h-full w-full overflow-ellipsis rounded-xl border-2 border-gray px-4 text-base md:text-2xl">
<SelectTrigger className="h-full w-full overflow-ellipsis rounded-xl border-2 border-gray px-4 text-left text-base md:text-2xl">
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>
{data.map((item) => (
<SelectItem value={item} key={item} className="text-lg">
{item.includes("University of California")
? "UC " + item.split(", ")[1]
: item}
</SelectItem>
))}
{data.map((item) => {
let option = item;

if (option.includes("University of California")) {
option = "UC " + item.split(", ")[1];
}

if (option.includes(": ")) {
option = item.split(": ")[1];
}

return (
<SelectItem
value={item}
key={item}
className="text-lg"
>
{option}
</SelectItem>
);
})}
</SelectContent>
</Select>
</div>
Expand Down

0 comments on commit c22317b

Please sign in to comment.