Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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