Mega UI revamp

This commit is contained in:
akhisud3195 2025-03-27 18:52:17 +05:30 committed by Ramnique Singh
parent 650f481a96
commit bcb686a20d
94 changed files with 6984 additions and 3889 deletions

View file

@ -0,0 +1,49 @@
import { Select, SelectItem, SelectProps } from "@heroui/react";
import { ReactNode, ChangeEvent } from "react";
export interface DropdownOption {
key: string;
label: string;
startContent?: ReactNode;
endContent?: ReactNode;
}
interface DropdownProps extends Omit<SelectProps, 'children' | 'onChange'> {
options: DropdownOption[];
value: string;
onChange: (value: string) => void;
className?: string;
width?: string | number;
containerClassName?: string;
}
export function Dropdown({
options,
value,
onChange,
className = "",
width = "100%",
containerClassName = "",
...selectProps
}: DropdownProps) {
return (
<div className={`${containerClassName}`} style={{ width }}>
<Select
{...selectProps}
selectedKeys={[value]}
onChange={(e: ChangeEvent<HTMLSelectElement>) => onChange(e.target.value)}
className={`${className}`}
>
{options.map((option) => (
<SelectItem
key={option.key}
startContent={option.startContent}
endContent={option.endContent}
>
{option.label}
</SelectItem>
))}
</Select>
</div>
);
}