Skip to content

Commit

Permalink
attempt at course-coreq hybrid search result w dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcarvajal committed Feb 6, 2025
1 parent d1cfe06 commit a5c9673
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions packages/frontend/components/AddCourseModal/SearchResult.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { AddIcon, InfoOutlineIcon } from "@chakra-ui/icons";
import { Box, Flex, IconButton, Text } from "@chakra-ui/react";
import {
AddIcon,
InfoOutlineIcon,
ChevronDownIcon,
ChevronUpIcon,
} from "@chakra-ui/icons";
import { Box, Flex, IconButton, Text, Collapse } from "@chakra-ui/react";
import { NUPathEnum, ScheduleCourse2, SeasonEnum } from "@graduate/common";
import { getCourseDisplayString } from "../../utils/";
import { GraduateToolTip } from "../GraduateTooltip";
import { NUPathLabel } from "./NUPathLabel";
import { getSearchLink } from "../ScheduleCourse";
import { useState } from "react";

interface SearchResultProps {
course: ScheduleCourse2<null>;
Expand Down Expand Up @@ -34,6 +40,8 @@ export const SearchResult: React.FC<SearchResultProps> = ({
: isResultAlreadySelected
? "This course is already selected."
: undefined;
/* This useState is only used for course-coreq hybrid search results */
const [opened, setOpened] = useState(false);

Check failure on line 44 in packages/frontend/components/AddCourseModal/SearchResult.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

'setOpened' is assigned a value but never used. Allowed unused vars must match /^_/u

return (
<Flex
Expand All @@ -52,7 +60,25 @@ export const SearchResult: React.FC<SearchResultProps> = ({
<Text as="span" fontSize="sm">
{course.name}
</Text>
{course.coreqs &&
(opened ? (
<ChevronUpIcon boxSize="25px" color="primary.red.main" />
) : (
<ChevronDownIcon boxSize="25px" color="primary.red.main" />
))}
</Box>
{course.coreqs && (
<Collapse in={opened} animateOpacity>
<Box
px="sm"
py="xs"
borderRadius="lg"
backgroundColor="transparent"
>
<Text fontSize="sm">"hi"</Text>

Check failure on line 78 in packages/frontend/components/AddCourseModal/SearchResult.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

`"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`

Check failure on line 78 in packages/frontend/components/AddCourseModal/SearchResult.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

`"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`
</Box>
</Collapse>
)}
<Box ml="auto" mr="sm"></Box>
<GraduateToolTip
label={`Search for ${getCourseDisplayString(course)} on SearchNEU`}
Expand Down

0 comments on commit a5c9673

Please sign in to comment.