Sha256: e1d079dbe3b7bea64be5d9646f379b0fe716789913a207f02121689b22692788

Contents?: true

Size: 1.38 KB

Versions: 44

Compression:

Stored size: 1.38 KB

Contents

/* @flow */

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

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

import Body from '../pb_body/_body'
import Title from '../pb_title/_title'

type LegendProps = {
  aria?: object,
  className?: string,
  color?: | "data_1"
    | "data_2"
    | "data_3"
    | "data_4"
    | "data_5"
    | "data_6"
    | "data_7",
  dark?: boolean,
  data?: object,
  id?: string,
  prefixText?: string,
  text: string,
}

const Legend = (props: LegendProps) => {
  const {
    aria = {},
    className,
    color = 'data_1',
    dark = false,
    data = {},
    id,
    prefixText,
    text,
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const bodyCss = classnames(
    buildCss('pb_legend_kit', color),
    globalProps(props),
    className
  )

  return (
    <div
        {...ariaProps}
        {...dataProps}
        className={bodyCss}
        id={id}
    >
      <Body color={dark ? 'lighter' : 'light'}>
        <span className="pb_legend_indicator_circle" />
        <If condition={prefixText}>
          <Title
              dark={dark}
              size={4}
              tag="span"
              text={` ${prefixText} `}
          />
        </If>
        {` ${text} `}
      </Body>
    </div>
  )
}

export default Legend

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.8.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.7.1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.7.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.6.2.pre.alpha.dep app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.6.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.5.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.4.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.3.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.2.1.alpha.sisensefix app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.2.1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.2.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.1.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.0.3.pre.alpha.walkthrough2 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.0.3.pre.alpha.walkthrough app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.0.1.alpha.railscusticon app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.0.2.pre.alpha.pre.iconfix app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.0.1.alpha.rtflexfix app/pb_kits/playbook/pb_legend/_legend.jsx