Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6847 | Rev 6861 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
6632 stevensc 1
import React from 'react'
6797 stevensc 2
import { Link } from 'react-router-dom'
6840 stevensc 3
import Badge from '../../UI/Badge'
6632 stevensc 4
 
5
const ListItemDropdown = ({ options = [], isShow }) => {
6
  if (!options.length) return null
6842 stevensc 7
 
6632 stevensc 8
  return (
9
    <nav className={`nav__options-dropdown ${isShow && 'show'}`}>
10
      <ul>
6798 stevensc 11
        {options.map(({ label, href, childs, count }, index) => (
6632 stevensc 12
          <li key={index}>
6798 stevensc 13
            <Link
14
              to={href[0] === '/' ? href : `/${href}`}
15
              onClick={(e) => childs.length && e.preventDefault()}
16
            >
17
              {label}
6848 stevensc 18
              {Boolean(count) && (
6847 stevensc 19
                <Badge count={count} className="position-relative" />
20
              )}
6798 stevensc 21
            </Link>
6843 stevensc 22
            {Boolean(childs?.length) && (
6632 stevensc 23
              <nav className="navigation-level_three">
24
                <ul>
6798 stevensc 25
                  {childs?.map((optionsChild, index) => (
6632 stevensc 26
                    <li key={index}>
6797 stevensc 27
                      <Link href={`/${optionsChild.href}`} target="framename">
6632 stevensc 28
                        {optionsChild.label}
6797 stevensc 29
                      </Link>
6632 stevensc 30
                    </li>
31
                  ))}
32
                </ul>
33
              </nav>
34
            )}
35
          </li>
36
        ))}
37
      </ul>
38
    </nav>
39
  )
40
}
41
 
42
export default ListItemDropdown