Sha256: 14ab63ca8cd2567fb91f16f4d91c2554f6247f1652dda943ba4badf47155ae63

Contents?: true

Size: 1.69 KB

Versions: 22

Compression:

Stored size: 1.69 KB

Contents

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?: { [key: string]: string },
  borderless?: boolean,
  children?: React.ReactNode[] | React.ReactNode,
  className?: string | string[],
  data?: object,
  dark?: boolean,
  highlight?: boolean,
  id?: string,
  onClick?: React.MouseEventHandler<HTMLElement>,
  orientation?: "vertical" | "horizontal",
  link: string,
  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}
    >
      {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>
      }
      <ul>{children}</ul>
    </nav>
  )
}

export default Nav

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
playbook_ui-12.17.1 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.17.0.pre.alpha.lightboxcurrentPhotoIndex582 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.17.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.16.0.pre.alpha.tooltippositionprop566 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.16.0.pre.alpha.PLAY693tooltipwrongbg558 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.16.0.pre.alpha.PLAY693tooltipwrongbg547 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.16.0.pre.alpha.PLAY693tooltipwrongbg532 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.16.0.pre.alpha.lightboxcurrentphotoprop531 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.16.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.15.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.14.0.pre.alpha.lightboxcurrentphotoprop460 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.14.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.13.0.pre.alpha.PLAY693tooltipwrongbg440 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.13.0.pre.alpha.addingProductTokens439 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.13.0.pre.alpha.PLAY705phonenumberkit438 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.13.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.12.0.pre.alpha.PLAY697sandpacklayoutstyles413 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.12.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.11.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.10.0.pre.alpha.PLAY705phonenumberreturn372 app/pb_kits/playbook/pb_nav/_nav.tsx