Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const Dropdown: React.FunctionComponent = ({
onSelect,
ref, // Types of Ref are different for React.FC vs React.Component
...props
}: DropdownProps) => (
onSelect && onSelect(event),
toggleTextClass: styles.dropdownToggleText,
toggleIconClass: styles.dropdownToggleIcon,
menuClass: styles.dropdownMenu,
itemClass: styles.dropdownMenuItem,
toggleClass: styles.dropdownToggle,
baseClass: styles.dropdown,
baseComponent: 'div',
sectionClass: styles.dropdownGroup,
sectionTitleClass: styles.dropdownGroupTitle,
sectionComponent: 'section',
disabledClass: styles.modifiers.disabled,
hoverClass: styles.modifiers.hover,
separatorClass: styles.dropdownSeparator
}}
>
);
{({ toggleClass }) => (
<button type="{type" id="{id}"> onToggle(!isOpen, event)}
aria-expanded={isOpen}
aria-haspopup={ariaHasPopup}
onKeyDown={event => this.onKeyDown(event)}
disabled={isDisabled}
>
{children}
</button>
return (
<div>
{children}
</div>
onToggle={onToggle}
ariaHasPopup={ariaHasPopup}
{...(splitButtonItems && { isSplitButton: true, 'aria-label': props['aria-label'] || 'Select' })}
>
{children && <span>{children}</span>}
{IconComponent && }
)}
);
if (splitButtonItems) {
return (
<div>
{splitButtonItems}
{toggle}
</div>
);
}
return toggle;
};
const DropdownToggle = ({ children, iconComponent: IconComponent, splitButtonItems, ...props }) => {
const toggle = (
{children && <span>{children}</span>}
{IconComponent && }
);
if (splitButtonItems) {
return (
<div>
{splitButtonItems}
{toggle}
</div>
);
}
return toggle;
};