Sha256: a48fd86a28a387895620bf53e8a8ce45fed0c29e70156904899216e414879615

Contents?: true

Size: 1.16 KB

Versions: 61

Compression:

Stored size: 1.16 KB

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,
  overflow?: "auto" | "hidden" | "initial" | "inherit" | "scroll" | "visible",
}

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

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

export default FlexItem

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
playbook_ui-8.2.0.pre.alpha3 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.2.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.1.2 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.1.0.pre.alpha1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.0.3 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.2.0.pre.alpha2 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.1.1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.0.2 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.2.0.pre.alpha1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.1.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.0.1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.0.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.0.0.pre.alpha5 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.0.0.pre.alpha4 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-8.0.0.pre.alpha1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-7.16.0.pre.alpha5 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-7.16.0.pre.alpha4 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-7.16.0.pre.alpha3 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-7.16.0.pre.alpha2 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-7.16.0.pre.alpha1 app/pb_kits/playbook/pb_flex/_flex_item.jsx