Skip to content

Commit

Permalink
refactor(DropdownItem): make wrapping of children with anchor tag opt…
Browse files Browse the repository at this point in the history
…ional
  • Loading branch information
kodjunkie committed Jul 18, 2023
1 parent 2e3e354 commit 395163f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Dropdown/DropdownItem.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react'

export type DropdownItemProps = React.AnchorHTMLAttributes<HTMLAnchorElement>
export type DropdownItemProps =
React.AnchorHTMLAttributes<HTMLAnchorElement> & { anchor?: boolean }

const DropdownItem = React.forwardRef<HTMLAnchorElement, DropdownItemProps>(
({ className, ...props }, ref) => {
({ anchor = true, ...props }, ref) => {
return (
<li className={className} role="menuitem">
<a ref={ref} {...props}></a>
<li role="menuitem">
{anchor ? <a ref={ref} {...props}></a> : props.children}
</li>
)
}
Expand Down

0 comments on commit 395163f

Please sign in to comment.