UNPKG

semantic-ui-react

Version:
42 lines (31 loc) 1.05 kB
import cx from 'clsx' import PropTypes from 'prop-types' import React from 'react' import { childrenUtils, customPropTypes, getElementType, getUnhandledProps } from '../../lib' /** * A menu can contain a sub menu. */ function MenuMenu(props) { const { children, className, content, position } = props const classes = cx(position, 'menu', className) const rest = getUnhandledProps(MenuMenu, props) const ElementType = getElementType(MenuMenu, props) return ( <ElementType {...rest} className={classes}> {childrenUtils.isNil(children) ? content : children} </ElementType> ) } MenuMenu.propTypes = { /** An element type to render as (string or function). */ as: PropTypes.elementType, /** Primary content. */ children: PropTypes.node, /** Additional classes. */ className: PropTypes.string, /** Shorthand for primary content. */ content: customPropTypes.contentShorthand, /** A sub menu can take left or right position. */ position: PropTypes.oneOf(['left', 'right']), } export default MenuMenu