Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6473 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

/* eslint-disable react/prop-types */
import React from 'react'

const ListItemDropdown = ({ options = [], isShow }) => {
  if (!options.length) return null
  return (
    <nav className={`nav__options-dropdown ${isShow && 'show'}`}>
      <ul>
        {options.map((linkOption, index) => (
          <li key={index}>
            {linkOption.childs?.length ? (
              <a href="/" onClick={(e) => e.preventDefault()}>
                {linkOption.label}
              </a>
            ) : (
              <a
                href={
                  linkOption.href[0] === '/'
                    ? linkOption.href
                    : `/${linkOption.href}`
                }
                target="framename"
              >
                {linkOption.label}
                {Boolean(linkOption.count) && (
                  <span
                    className="badge position-relative ml-2"
                    style={{ left: 'auto', transform: 'none' }}
                  >
                    {linkOption.count}
                  </span>
                )}
              </a>
            )}
            {!!linkOption.childs?.length && (
              <nav className="navigation-level_three">
                <ul>
                  {linkOption.childs?.map((optionsChild, index) => (
                    <li key={index}>
                      <a href={`/${optionsChild.href}`} target="framename">
                        {optionsChild.label}
                      </a>
                    </li>
                  ))}
                </ul>
              </nav>
            )}
          </li>
        ))}
      </ul>
    </nav>
  )
}

export default ListItemDropdown