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-9.7.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.6.1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.6.1.pre.deps1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.6.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.5.0.alpha.rs.downgrade app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.5.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.4.0.alpha.sisense app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.4.0.alpha.user.kit.bug app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.4.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.3.1.pre.alpha2 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.4.0.pre.alpha2 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.4.0.pre.alpha1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.3.1.pre.alpha1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.3.0.alpha.inline3 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.3.0.pre.alpha.password.strength.2 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.3.0.alpha.inline2 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.3.0.alpha.inline1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.3.0.pre.alpha.password.strength.1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.3.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-9.2.2.pre.alpha.margin app/pb_kits/playbook/pb_flex/_flex_item.jsx