Sha256: 5e32d34d29ec442c067b2f15b0f7c1683796bbbf82cdd5f744990055fd35a3cf

Contents?: true

Size: 1.49 KB

Versions: 14

Compression:

Stored size: 1.49 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
}

// All Exported as a single function
export const globalProps = (props, defaultProps = {}) => {
  const allProps = { ...props, ...defaultProps }
  return spacingProps(allProps) + darkProps(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

14 entries across 14 versions & 1 rubygems

Version Path
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.13.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.12.1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.12.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.11.1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.11.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.11.0.pre.alpha1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.10.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.9.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.8.4 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.8.3 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.8.2 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.8.1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-7.8.0 app/pb_kits/playbook/utilities/globalProps.js