Sha256: b984cc3b9c548058772904a16c718266dbbfa387397ec08abe308f1bbf6c162f

Contents?: true

Size: 1015 Bytes

Versions: 3

Compression:

Stored size: 1015 Bytes

Contents

/* @flow */
import React from 'react'
import classnames from 'classnames'
import { buildCss } from '../utilities/props'
import { globalProps } from '../utilities/globalProps.js'
type FlexItemPropTypes = {
  children: array<React.ReactNode> | React.ReactNode,
  fixedSize: string,
  grow: boolean,
  shrink: boolean,
  flex: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'none',
  className: string,
}

const FlexItem = (props: FlexItemPropTypes) => {
  const { children, className, fixedSize, grow, shrink, flex } = props
  const growClass = grow === true ? 'grow' : ''
  const flexClass = flex !== 'none' ? `flex_${flex}` : ''
  const shrinkClass = shrink === true ? 'shrink' : ''
  const fixedStyle =
    fixedSize !== undefined ? { flexBasis: `${fixedSize}` } : null

  return (
    <div
        className={classnames(buildCss('pb_flex_item_kit', growClass, shrinkClass, flexClass), globalProps(props), className)}
        style={fixedStyle}
    >
      {children}
    </div>
  )
}

export default FlexItem

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-7.14.0.pre.alpha1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-7.15.1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-7.15.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx