Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Tier1.Header = forwardRef((props, ref) => {
const { active, collapsed, collapsible, children, icon, ...rest } = props
const hideLabels = useHideLabels()
const TagName = rest.href ? 'a' : rest.onClick ? 'button' : 'span'
return (
{icon &&
cloneElement(icon, {
size: CaretDownIcon.sizes.medium,
...styles.itemIcon(),
...(active ? { 'data-active': true } : {})
})}
<span>{children}</span>
{collapsible && (
)}
)
})
{...styles.tier1Header()}
{...filterReactProps(rest, { tagName: TagName })}
ref={ref}
>
{icon &&
cloneElement(icon, {
size: CaretDownIcon.sizes.medium,
...styles.itemIcon(),
...(active ? { 'data-active': true } : {})
})}
<span>{children}</span>
{collapsible && (
)}
)
})
return (
<button aria-label="{getButtonAriaLabel()}">
<span>{children}</span>
</button>
)
})