-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from CS3219-AY2425S1/feature/question-service…
…/filter-questions Add filter questions
- Loading branch information
Showing
5 changed files
with
142 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import QuestionListing from "@/components/questions/questions-listing"; | ||
import { Suspense } from "react"; | ||
|
||
export default function QuestionListingPage() { | ||
return <QuestionListing />; | ||
return ( | ||
<Suspense> | ||
<QuestionListing /> | ||
</Suspense> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
import { Button } from "@/components/ui/button"; | ||
import { Input } from "@/components/ui/input"; | ||
import { Label } from "@/components/ui/label"; | ||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from "@/components/ui/select"; | ||
|
||
interface QuestionFilterProps { | ||
category: string; | ||
onCategoryChange: (search: string) => void; | ||
complexity: string; | ||
onComplexityChange: (complexity: string) => void; | ||
onReset: () => void; | ||
} | ||
|
||
const QuestionFilter: React.FC<QuestionFilterProps> = ({ | ||
category, | ||
onCategoryChange, | ||
complexity, | ||
onComplexityChange, | ||
onReset, | ||
}) => { | ||
return ( | ||
<Card className="mb-6"> | ||
<CardHeader> | ||
<CardTitle>Filter Questions</CardTitle> | ||
</CardHeader> | ||
<CardContent> | ||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4"> | ||
<div> | ||
<Label htmlFor="category">Category</Label> | ||
<Input | ||
id="category" | ||
value={category} | ||
onChange={(e) => onCategoryChange(e.target.value)} | ||
placeholder="Enter category" | ||
className="mt-1" | ||
/> | ||
</div> | ||
<div> | ||
<Label htmlFor="complexity">Complexity</Label> | ||
<Select | ||
value={complexity} | ||
onValueChange={(value) => onComplexityChange(value)} | ||
> | ||
<SelectTrigger id="complexity" className="mt-1"> | ||
<SelectValue placeholder="Select complexity" /> | ||
</SelectTrigger> | ||
<SelectContent> | ||
<SelectItem value="all">All</SelectItem> | ||
<SelectItem value="easy">Easy</SelectItem> | ||
<SelectItem value="medium">Medium</SelectItem> | ||
<SelectItem value="hard">Hard</SelectItem> | ||
</SelectContent> | ||
</Select> | ||
</div> | ||
</div> | ||
<Button onClick={onReset} variant="outline" className="mt-4"> | ||
Reset Filters | ||
</Button> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default QuestionFilter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters