Sha256: 327995025421084d9dbf2ebfe6163d839885eb30504fe9b500e98ac2154cd8d3

Contents?: true

Size: 1.72 KB

Versions: 150

Compression:

Stored size: 1.72 KB

Contents

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

import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
import { globalProps, 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",
} & GlobalProps

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

150 entries across 150 versions & 1 rubygems

Version Path
playbook_ui-12.31.0.pre.alpha.hoverrails948 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.31.0.pre.alpha.multilevelnopillsdesigns944 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.31.0.pre.alpha.multilevelnopillsdesigns941 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.31.0.pre.alpha.PLAY814removemomentjs935 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.31.0.pre.alpha.PLAY814removemomentjs933 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.31.0.pre.alpha.datepickerdisableddatefix931 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.31.0.pre.alpha.customiconsfa928 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.31.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.30.1.pre.alpha.play846responsivespacingglobalpropsneedsdefault924 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop917 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop916 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.30.1.pre.alpha.hovertesting914 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop912 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.30.1.pre.alpha.PLAY802responsivetitlekit909 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.30.0.pre.alpha.PLAY906multilevelselectedidsprop902 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.30.1 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.30.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.29.0.pre.alpha.play716popoverkitcloseonclickissue893 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.29.0 app/pb_kits/playbook/pb_nav/_nav.tsx
playbook_ui-12.28.0.pre.alpha.PLAY863multilevelv2877 app/pb_kits/playbook/pb_nav/_nav.tsx