dropdown
This commit is contained in:
parent
0ee3911096
commit
eba2e740af
|
|
@ -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}>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user