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.15.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.14.0.pre.alpha.lightboxcurrentphotoprop460 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown457 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown456 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.14.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.13.0.pre.alpha.PLAY693tooltipwrongbg440 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.13.0.pre.alpha.addingProductTokens439 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.13.0.pre.alpha.PLAY705phonenumberkit438 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.13.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.12.0.pre.alpha.PLAY697sandpacklayoutstyles413 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.12.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.11.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.10.0.pre.alpha.PLAY705phonenumberreturn372 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.10.0.pre.alpha.PLAY677richtexteditorts370 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.10.0 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.9.1.pre.alpha.play664tiptapinvestigation353 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.9.1.pre.alpha.PLAY689bugtxtinputlabel346 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.9.1.pre.alpha.menucleanup345 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.9.1.pre.alpha.menucleanup342 app/pb_kits/playbook/pb_flex/_flex_item.jsx
playbook_ui-12.9.1 app/pb_kits/playbook/pb_flex/_flex_item.jsx