Sha256: 6e6839d16402021225bd432742ceab8c37d1a604dacd8b7398ecdf841a661009

Contents?: true

Size: 1.29 KB

Versions: 72

Compression:

Stored size: 1.29 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?: string,
  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

72 entries across 72 versions & 1 rubygems

Version Path
playbook_ui-10.22.1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.22.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.21.1.pre.alpha1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.21.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.20.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-10.19.0 app/pb_kits/playbook/pb_legend/_legend.jsx