Sha256: ae941f941b6087a88cc0a10282658fac8c5eeaae17c7b567ae46a3bb4c4cd789

Contents?: true

Size: 1.37 KB

Versions: 21

Compression:

Stored size: 1.37 KB

Contents

/* @flow */

import React from 'react'
import { Icon } from '../'

type NavItemProps = {
  text: String,
  link: String,
  iconLeft: String,
  iconRight: String,
  active?: Boolean,
  children: React.Node,
  onClick?: EventHandler,
}

const NavItem = ({
  text = '',
  link,
  active = false,
  iconLeft,
  iconRight,
  children,
  onClick = () => {},
}: NavItemProps) => {
  const Tag = link ? 'a' : 'div'

  return (
    <li className={`pb_nav_list_kit_item${active ? '_active' : ''}`}>
      <Tag
          className="pb_nav_list_item_link"
          href={link}
          onClick={onClick}
      >
        <If condition={iconLeft}>
          <div
              className="pb_nav_list_item_icon_section"
              key={iconLeft}
          >
            <Icon
                className="pb_nav_list_item_icon_left"
                fixedWidth
                icon={iconLeft}
            />
          </div>
        </If>
        <span className="pb_nav_list_item_text">
          {text || children}
        </span>
        <If condition={iconRight}>
          <div
              className="pb_nav_list_item_icon_section"
              key={iconRight}
          >
            <Icon
                className="pb_nav_list_item_icon_right"
                fixedWidth
                icon={iconRight}
            />
          </div>
        </If>
      </Tag>
    </li>
  )
}
export default NavItem

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
playbook_ui-6.1.0.pre.alpha5 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.1.0.pre.alpha4 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.1.0.pre.alpha3 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.1.0.pre.alpha2 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.1.0.pre.alpha1 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.1.0 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.0.1.pre.alpha6 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-5.5.1 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-5.5.0 app/pb_kits/playbook/pb_nav/_item.jsx
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_nav/_item.jsx