Skip to content
Closed
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
22 changes: 19 additions & 3 deletions app/components/FilterComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface CheckboxOptions {
courses?: Option[];
slots?: Option[];
years?: Option[];
examTypes?: Option[];
}

interface DropdownProps {
Expand Down Expand Up @@ -76,7 +77,12 @@ const Dropdown: React.FC<DropdownProps> = ({ pageType }) => {
{ id: 'G1', label: 'G1' },
{ id: 'G2', label: 'G2' },

],
],
examTypes: [
{ id: 'cat1', label: 'CAT-1' },
{ id: 'cat2', label: 'CAT-2' },
{ id: 'fat', label: 'FAT' },
]
};

const handleSelectionChange = useCallback((category: keyof CheckboxOptions, selection: string[]) => {
Expand Down Expand Up @@ -106,8 +112,8 @@ const Dropdown: React.FC<DropdownProps> = ({ pageType }) => {
{isOpen ? <FontAwesomeIcon icon={faCaretUp} className="ml-2" /> : <FontAwesomeIcon icon={faCaretDown} className="ml-2" />}
</button>
<div className={`hide-scrollbar flex flex-col sm:flex-row sm:space-x-4 justify-center items-start absolute left-0 mt-2 w-full w-[80vw] sm:w-auto sm:max-w-[1200px] border-2 border-black dark:border-white bg-[#4AD0FF] dark:bg-[#232530] z-50 overflow-auto ${isOpen ? '' : 'hidden'}`}>
{checkboxOptions.slots && (
<div className="w-full p-4 sm:p-2 flex flex-wrap justify-center font-bold">
{checkboxOptions.slots && (
<div className="w-full p-4 sm:p-2 flex flex-wrap justify-center font-bold">
<FilterComp
title="Slots"
options={checkboxOptions.slots}
Expand All @@ -117,6 +123,16 @@ const Dropdown: React.FC<DropdownProps> = ({ pageType }) => {
/>
</div>
)}
{checkboxOptions.examTypes && (
<div className="w-full p-4 sm:p-2 flex flex-wrap justify-center font-bold">
<FilterComp
title="Exam Type"
options={checkboxOptions.examTypes}
onSelectionChange={(selection) => handleSelectionChange('examTypes', selection)}
selectedOptions={selectedTags.filter(tag => checkboxOptions.examTypes!.some(option => option.label === tag))}
/>
</div>
)}
</div>
</div>
);
Expand Down