Sha256: b4f3d435af03815822bada7a7d11a580b43eb3c6fe5645f77b1e002c3d53363d

Contents?: true

Size: 1.62 KB

Versions: 156

Compression:

Stored size: 1.62 KB

Contents

/* @flow */
import React from 'react'
import classnames from 'classnames'
import { buildCss } from '../utilities/props'
import { globalProps } from '../utilities/globalProps'
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",
  order?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'first' | 'none',
  alignSelf?: "start" | "end" | "center" | "stretch",
  displayFlex: boolean
}

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

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

export default FlexItem

Version data entries

156 entries across 156 versions & 1 rubygems

Version Path
playbook_ui-12.9.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.8.0.pre.alpha.PLAY625phonenumberdark301 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.8.0.pre.alpha.PLAY625phonenumberdark300 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.8.0.pre.alpha.PLAY649mapkitstyles299 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.8.0.pre.alpha.PLAY645typescriptprogresstep298 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.8.0.pre.alpha.PLAY645typescriptprogresstep297 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.8.0.pre.alpha.rubyandnpmalpharelease296 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.8.0.pre.alpha.rubyandnpmalpharelease295 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.8.0.pre.alpha.rubyandnpmalpharelease294 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.8.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.7.1.pre.alpha.rubyandnpmalpharelease293 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.7.1.pre.alpha.rubyandnpmalpharelease292 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.7.1.pre.alpha.rubyandnpmalpharelease291 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.7.1.pre.alpha.alpharubyrelease281 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.7.1.pre.alpha.menu2 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.7.1.pre.alpha.menu1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.7.1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.7.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.6.0.pre.alpha.sectionseparator1 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.6.0.pre.alpha.menuyml1 app/pb_kits/playbook/pb_flex/_flex_item.jsx