Sha256: a4355285d4a1725cbb22ef5166b7a05fe849022c4f82bad51b528717fe7eef79

Contents?: true

Size: 1.39 KB

Versions: 174

Compression:

Stored size: 1.39 KB

Contents

/* @flow */

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

type BodyProps = {
  aria?: object,
  className?: string,
  children?: array<React.ReactChild>,
  color?: 'default' | 'light' | 'lighter',
  dark?: boolean,
  data?: object,
  highlightedText?: array<string>,
  highlighting?: boolean,
  id?: string,
  status?: 'negative' | 'neutral' | 'positive',
  tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
  text?: string,
}

const Body = (props: BodyProps) => {
  const {
    aria = {},
    className,
    children,
    color = '',
    data = {},
    highlightedText = [],
    highlighting = false,
    id,
    status,
    tag = 'div',
    text,
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const classes = classnames(
    buildCss('pb_body_kit', color, status),
    globalProps(props),
    className
  )
  const Tag = `${tag}`

  return (
    <Tag
        {...ariaProps}
        {...dataProps}
        className={classes}
        id={id}
    >
      <If condition={highlighting}>
        <Highlight highlightedText={highlightedText}>{text || children}</Highlight>
        <Else />
        { text || children }
      </If>
    </Tag>
  )
}

export default Body

Version data entries

174 entries across 174 versions & 1 rubygems

Version Path
playbook_ui-9.19.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.19.0.pre.alphafonts app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.18.0.flow.bin.alpha app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.18.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.17.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.17.0.pre.decouple.website2 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.16.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.15.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.15.0.pre.decouple.website1 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.14.1.alpha.radio.alignment app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.14.1.alpha.highcharts9 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.14.1 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.13.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.12.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.12.0.pre.text.addon app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.11.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.10.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.10.0.pre.date.time.stacked.1 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.10.0.pre.alpha2 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-9.10.0.pre.alpha1 app/pb_kits/playbook/pb_body/_body.jsx