All files / theme themeSelectors.js

100% Statements 17/17
100% Branches 6/6
100% Functions 2/2
100% Lines 16/16

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 22328x 525x 8x   517x 8x   509x 8x   501x     41x 41x 41x 41x 41x 41x 41x 41x  
const createSelector = category => (theme) => {
  if (!theme) {
    throw new Error('You need to provide a theme object');
  }
  if (!theme.uiKit) {
    throw new Error('Your theme has to be under uiKit key');
  }
  if (!theme.uiKit[category]) {
    throw new Error(`Your theme is missing ${category} key`);
  }
  return theme.uiKit[category];
};
 
export const getTypography = createSelector('typography');
export const getColors = createSelector('colors');
export const getButton = createSelector('button');
export const getForm = createSelector('form');
export const getHeading = createSelector('heading');
export const getText = createSelector('text');
export const getColorBox = createSelector('colorBox');
export const getLink = createSelector('link');