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-9.12.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.12.0.pre.text.addon app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.11.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.10.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.10.0.pre.date.time.stacked.1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.10.0.pre.alpha2 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.10.0.pre.alpha1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.9.0.alpha.inline1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.9.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.8.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.7.0.pre.alphawidth1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.7.0.pre.alpha.a11y.btn app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.7.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.6.1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.6.1.pre.deps1 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.6.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.5.0.alpha.rs.downgrade app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.5.0 app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.4.0.alpha.sisense app/pb_kits/playbook/utilities/globalProps.js
playbook_ui-9.4.0.alpha.user.kit.bug app/pb_kits/playbook/utilities/globalProps.js