components.snippets.SearchBar.SearchBarPopUpList.jsx Maven / Gradle / Ivy
The newest version!
import React from 'react'
import PropTypes from 'prop-types'
import get from 'lodash/get'
import classNames from 'classnames'
import { DropdownMenu, DropdownItem } from 'reactstrap'
import { RenderLink, renderDivider, itemInSearchBarClassName } from './utils'
export function SearchBarPopUpList({
labelFieldId,
descriptionFieldId,
iconFieldId,
urlFieldId,
menu,
directionIconsInPopUp,
onItemClick,
}) {
return (
{menu.map((linkProps) => {
const { id, disabled = false, linkType } = linkProps
const description = get(linkProps, descriptionFieldId)
const label = get(linkProps, labelFieldId)
const icon = get(linkProps, iconFieldId)
const href = get(linkProps, urlFieldId)
return (
{renderDivider(linkProps)}
)
})}
)
}
SearchBarPopUpList.propTypes = {
/**
* Данные для PopUp
*/
menu: PropTypes.array,
/**
* направление иконок и items в popUp: left(default), right
*/
directionIconsInPopUp: PropTypes.string,
onItemClick: PropTypes.func,
labelFieldId: PropTypes.string,
descriptionFieldId: PropTypes.string,
iconFieldId: PropTypes.string,
urlFieldId: PropTypes.string,
}
export default SearchBarPopUpList