Sha256: e3afc637021f7120c8c588be14149df383a522196496ba0dc625dbea7447fee0

Contents?: true

Size: 1.62 KB

Versions: 73

Compression:

Stored size: 1.62 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
import { Caption } from '../'
import { globalProps } from '../utilities/globalProps.js'

type NavProps = {
  aria?: object,
  borderless?: boolean,
  children?: React.Node,
  className?: string | array<string>,
  data?: object,
  highlight?: boolean,
  id?: string,
  onClick?: EventHandler,
  orientation?: "vertical" | "horizontal",
  link: SVGFESpecularLightingElement,
  title: string,
  variant?: "normal" | "subtle",
}
const Nav = (props: NavProps) => {
  const {
    aria = {},
    borderless = false,
    children,
    className,
    data = {},
    highlight = true,
    id,
    link = '#',
    onClick = () => {},
    orientation = 'vertical',
    title = '',
    variant = 'normal',
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const cardCss = classnames(
    buildCss('pb_nav_list', variant, orientation, {
      highlight: highlight,
      borderless: borderless,
    }),
    globalProps(props),
    className
  )

  return (
    <nav
        {...ariaProps}
        {...dataProps}
        className={cardCss}
        id={id}
    >
      <If condition={title}>
        <div className="pb_nav_list_title">
          <a
              className="pb_nav_list_item_link_text"
              href={link}
              onClick={onClick}
          >
            <Caption
                size="md"
                text={`${title}`}
            />
          </a>
        </div>
      </If>
      <ul>{children}</ul>
    </nav>
  )
}

export default Nav

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
playbook_ui-9.9.0.alpha.inline1 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.9.0 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.8.0 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.7.0.pre.alphawidth1 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.7.0.pre.alpha.a11y.btn app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.7.0 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.6.1 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.6.1.pre.deps1 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.6.0 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.5.0.alpha.rs.downgrade app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.5.0 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.4.0.alpha.sisense app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.4.0.alpha.user.kit.bug app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.4.0 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.3.1.pre.alpha2 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.4.0.pre.alpha2 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.4.0.pre.alpha1 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.3.1.pre.alpha1 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.3.0.alpha.inline3 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-9.3.0.pre.alpha.password.strength.2 app/pb_kits/playbook/pb_nav/_nav.jsx