Sha256: fed81c00bb2ee60d360792531fc9dde93f43eede77ecfd9b894134df0cd177c9

Contents?: true

Size: 1.7 KB

Versions: 24

Compression:

Stored size: 1.7 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'

import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
import { globalProps } from '../utilities/globalProps'

import Caption from '../pb_caption/_caption'

type NavProps = {
  aria?: object,
  borderless?: boolean,
  children?: React.Node,
  className?: string | array<string>,
  data?: object,
  dark?: boolean,
  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 = {},
    dark = false,
    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
                dark={dark}
                size="md"
                text={`${title}`}
            />
          </a>
        </div>
      </If>
      <ul>{children}</ul>
    </nav>
  )
}

export default Nav

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
playbook_ui-12.9.1.pre.alpha.play664tiptapinvestigation353 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.9.1.pre.alpha.PLAY689bugtxtinputlabel346 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.9.1.pre.alpha.menucleanup345 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.9.1.pre.alpha.menucleanup342 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.9.1 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.9.0 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.8.0.pre.alpha.PLAY625phonenumberdark301 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.8.0.pre.alpha.PLAY625phonenumberdark300 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.8.0.pre.alpha.PLAY649mapkitstyles299 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.8.0.pre.alpha.PLAY645typescriptprogresstep298 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.8.0.pre.alpha.PLAY645typescriptprogresstep297 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.8.0.pre.alpha.rubyandnpmalpharelease296 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.8.0.pre.alpha.rubyandnpmalpharelease295 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.8.0.pre.alpha.rubyandnpmalpharelease294 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.8.0 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.7.1.pre.alpha.rubyandnpmalpharelease293 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.7.1.pre.alpha.rubyandnpmalpharelease292 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.7.1.pre.alpha.rubyandnpmalpharelease291 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.7.1.pre.alpha.alpharubyrelease281 app/pb_kits/playbook/pb_nav/_nav.jsx
playbook_ui-12.7.1.pre.alpha.menu2 app/pb_kits/playbook/pb_nav/_nav.jsx