All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.snippets.SearchBar.utils.jsx Maven / Gradle / Ivy

The newest version!
import React from 'react'
import classNames from 'classnames'
import isString from 'lodash/isString'
import { NavLink, NavItem, DropdownItem } from 'reactstrap'
import { BrowserRouter } from 'react-router-dom'

const iconInPopUpClassName = (icon, directionIconsInPopUp) => classNames(icon, {
    'n2o-search-bar__popup_icon-left': directionIconsInPopUp === 'left',
    'n2o-search-bar__popup_icon-right': directionIconsInPopUp === 'right',
})

export const itemInSearchBarClassName = directionIconsInPopUp => classNames({
    'n2o-search-bar__popup_item-right': directionIconsInPopUp === 'right',
    'n2o-search-bar__popup_item-left': directionIconsInPopUp === 'left',
})

const renderIcon = (icon, directionIconsInPopUp) => (isString(icon) ? (
    
) : (
    icon
))

export const renderDescription = (description, disabled) => (description && disabled ? (
    
{description}
) : ( description && (
{description}
) )) // eslint-disable-next-line react/prop-types export const RenderLink = ({ label, description, icon, href, ...props }) => { // eslint-disable-next-line react/prop-types const { linkType, disabled, directionIconsInPopUp } = props return linkType === 'inner' ? (
{renderIcon(icon, directionIconsInPopUp)}
{label} {renderDescription(description, disabled)}
) : (
{renderIcon(icon, directionIconsInPopUp)}
{label} {renderDescription(description)}
) } export const renderDivider = (props) => { const { separateLink } = props return separateLink && separateLink === true && }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy