Sha256: 1a9bd115f1ca3336cb26f19c2528025ea308567e5a557968b0a7382ed368c726

Contents?: true

Size: 1.34 KB

Versions: 189

Compression:

Stored size: 1.34 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
import { globalProps } from '../utilities/globalProps.js'

import { Body, Title } from '../'

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

189 entries across 189 versions & 1 rubygems

Version Path
playbook_ui-7.16.0.pre.alpha5 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.16.0.pre.alpha4 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.16.0.pre.alpha3 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.16.0.pre.alpha2 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.16.0.pre.alpha1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.14.0.pre.alpha1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.16.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.15.1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.15.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.14.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.13.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.12.1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.12.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.11.1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.11.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.11.0.pre.alpha1 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.10.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.9.0 app/pb_kits/playbook/pb_legend/_legend.jsx
playbook_ui-7.8.4 app/pb_kits/playbook/pb_legend/_legend.jsx