All files / layout/grid/src helpers.js

45.45% Statements 5/11
27.27% Branches 3/11
25% Functions 1/4
45.45% Lines 5/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21    1x 5x   5x 5x                   1x        
import {BASE_CLASS, BREAKPOINTS, GUTTER_VALUES} from './settings.js'
 
export const getGutterClassNames = (gutterConfig = {}) => {
  Iif (GUTTER_VALUES.includes(gutterConfig)) {
    return `${BASE_CLASS}--gutter-${BREAKPOINTS.XXS}-${gutterConfig}`
  } else Eif (typeof gutterConfig === 'object') {
    return Object.entries(gutterConfig)
      .map(([key, value]) =>
        Object.values(BREAKPOINTS).includes(key) ? `${BASE_CLASS}--gutter-${key}-${value}` : null
      )
      .filter(value => value !== null)
      .join(' ')
  }
  return null
}
 
export const transition = ({isGapless, ...oldProps}) => {
  const gutter = oldProps.gutter || isGapless ? 0 : undefined
  return {gutter, ...oldProps}
}