Skip to content
Snippets Groups Projects
Commit aa3fb987 authored by Lukas's avatar Lukas
Browse files

Create post type selector component

parent b9fff2b8
No related branches found
No related tags found
1 merge request!508Lbudginas/#407 add comment type filter
import { ChangeEventHandler } from "react";
import Explorer from "@/types/Explorer";
const COMMENT_TYPES = ["all", "post", "comment"];
interface PostTypeSelectorProps {
showLabel?: boolean | undefined;
handleChange: ChangeEventHandler<HTMLSelectElement>;
commentType: Explorer.CommentType;
}
const PostTypeSelector: React.FC<PostTypeSelectorProps> = ({
showLabel = false,
handleChange,
commentType,
}) => {
return (
<div className="flex flex-col gap-2">
{showLabel && <label>Select comment type</label>}
<select
onChange={handleChange}
value={commentType}
className="border p-2 rounded bg-theme text-text"
>
{COMMENT_TYPES.map((type, index) => (
<option
key={index}
value={type}
>
{type.charAt(0).toUpperCase() + type.slice(1)}
</option>
))}
</select>
</div>
);
};
export default PostTypeSelector;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment