Sha256: f78e262b77a6a73fe7a8b0c3db51a1ef7826083e8f17a70cb2ccd7a3a3a77f82

Contents?: true

Size: 1.77 KB

Versions: 92

Compression:

Stored size: 1.77 KB

Contents

// Prop categories
const spacingProps = ({
  marginRight,
  marginLeft,
  marginTop,
  marginBottom,
  marginX,
  marginY,
  margin,
  paddingRight,
  paddingLeft,
  paddingTop,
  paddingBottom,
  paddingX,
  paddingY,
  padding,
}) => {
  let css = ''
  css += marginRight ? `mr_${marginRight} ` : ''
  css += marginLeft ? `ml_${marginLeft} ` : ''
  css += marginTop ? `mt_${marginTop} ` : ''
  css += marginBottom ? `mb_${marginBottom} ` : ''
  css += marginX ? `mx_${marginX} ` : ''
  css += marginY ? `my_${marginY} ` : ''
  css += margin ? `m_${margin} ` : ''
  css += paddingRight ? `pr_${paddingRight} ` : ''
  css += paddingLeft ? `pl_${paddingLeft} ` : ''
  css += paddingTop ? `pt_${paddingTop} ` : ''
  css += paddingBottom ? `pb_${paddingBottom} ` : ''
  css += paddingX ? `px_${paddingX} ` : ''
  css += paddingY ? `py_${paddingY} ` : ''
  css += padding ? `p_${padding} ` : ''
  return css
}

const darkProps = ({ dark }) => {
  let css = ''
  css += dark ? 'dark' : ''
  return css
}

const maxWidthProps = ({ maxWidth }) => {
  let css = ''
  css += maxWidth ? `max_width_${maxWidth } ` : ''
  return css
}

const zIndexProps = ({ zIndex }) => {
  let css = ''
  css += zIndex ? `z_index_${zIndex } ` : ''
  return css
}

// All Exported as a single function
export const globalProps = (props, defaultProps = {}) => {
  const allProps = { ...props, ...defaultProps }
  return spacingProps(allProps) + darkProps(allProps) + maxWidthProps(allProps) + zIndexProps(allProps)
}

export const deprecatedProps = (kit, props = []) => {
  if (process.env.NODE_ENV === 'development') {
    /* eslint no-console: ["error", { allow: ["warn", "error"] }] */
    props.forEach((prop) => {
      console.warn(`${kit} Kit: The prop '${prop}' is deprecated and will be removed in a future release!`)
    })
  }
}

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
playbook_ui-10.0.1.alpha.railscusticon app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-10.0.2.pre.alpha.pre.iconfix app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-10.0.1.alpha.rtflexfix app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-10.0.0.pre.alphafonts app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-10.0.1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-10.0.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.19.0.pre.alpha.pre.fonts2 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.19.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.19.0.pre.alphafonts app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.18.0.flow.bin.alpha app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.18.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.17.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.17.0.pre.decouple.website2 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.16.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.15.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.15.0.pre.decouple.website1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.14.1.alpha.radio.alignment app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.14.1.alpha.highcharts9 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.14.1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.13.0 app/pb_kits/playbook/utilities/globalProps.js