mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-11 00:02:38 +02:00
Mega UI revamp
This commit is contained in:
parent
650f481a96
commit
bcb686a20d
94 changed files with 6984 additions and 3889 deletions
49
apps/rowboat/components/ui/dropdown.tsx
Normal file
49
apps/rowboat/components/ui/dropdown.tsx
Normal 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>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue