import React from "react";
// headless ui
import { Listbox, Transition } from "@headlessui/react";
// icons
import { ChevronDownIcon } from "@heroicons/react/20/solid";
type CustomSelectProps = {
value: any;
onChange: (props: any) => void;
children: React.ReactNode;
label: string | JSX.Element;
textAlignment?: "left" | "center" | "right";
maxHeight?: "sm" | "rg" | "md" | "lg" | "none";
width?: "auto" | string;
input?: boolean;
noChevron?: boolean;
};
const CustomSelect = ({
children,
label,
textAlignment,
value,
onChange,
maxHeight = "none",
width = "auto",
input = false,
noChevron = false,
}: CustomSelectProps) => {
return (
{label}
{!noChevron && }
{children}
);
};
type OptionProps = {
children: string | JSX.Element;
value: any;
className?: string;
};
const Option: React.FC = ({ children, value, className }) => {
return (
`${selected ? "bg-indigo-50 font-medium" : ""} ${
active ? "bg-indigo-50" : ""
} relative flex cursor-pointer select-none items-center gap-2 truncate p-2 text-gray-900 ${className}`
}
>
{children}
);
};
CustomSelect.Option = Option;
export default CustomSelect;