Skip to content

Commit

Permalink
fix(ActionsMenu): Prop doc was spread to ActionsMenuItem child
Browse files Browse the repository at this point in the history
  • Loading branch information
JF-Cozy committed Jun 20, 2023
1 parent 4264903 commit a2160c1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion react/ActionsMenu/ActionsMenuItem.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'
import omit from 'lodash/omit'

import MenuItem from '../MenuItem'
import ListItem from '../MuiCozyTheme/ListItem'

const cleanPropsForDOM = props => {
const nonDOMProps = ['doc']

return omit(props, nonDOMProps)
}

const ActionsMenuItem = forwardRef(({ isListItem, ...props }, ref) => {
const Component = isListItem ? ListItem : MenuItem
const compProps = cleanPropsForDOM(props)

return <Component {...props} ref={ref} button ellipsis={false} />
return <Component {...compProps} ref={ref} button ellipsis={false} />
})

ActionsMenuItem.displayName = 'ActionsMenuItem'
Expand Down

0 comments on commit a2160c1

Please sign in to comment.