This commit is contained in:
Regi 2022-10-23 18:48:19 +02:00
parent 0ee3911096
commit eba2e740af

View File

@ -104,13 +104,18 @@ let Dropdown = React.forwardRef(({ children, dropdownCss, onValueChanged, button
}); });
export default Dropdown; export default Dropdown;
export function DropdownMenu({ children, fallback, notSelectedOne = true, value, onChange, ...props }) { export function DropdownMenu({ children, fallback, button, notSelectedOne = true, value, onChange, ...props }) {
let ref = useRef() let ref = useRef()
let btn = fallback ?? ""; let btn = fallback ?? "";
if (children && children.length > 0) if (children && children.length > 0)
btn = children[value > children.length ? 0 : value] btn = children[value > children.length ? 0 : value]
if(button != null)
{
btn = button(btn, value > children.length ? 0 : value);
}
return <> return <>
<Dropdown ref={ref} button={btn} {...props}> <Dropdown ref={ref} button={btn} {...props}>
{ {