All files / atoms/Paper index.jsx

38.46% Statements 5/13
0% Branches 0/6
0% Functions 0/2
41.66% Lines 5/12

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 22 23 24 25 26 27 28 29 30 31 32 33 34 35              1x                           1x   1x 1x       1x            
import React, { forwardRef } from 'react';
import PropTypes from 'prop-types';
 
import Font from '../Font';
import withStyle from '../../Theme/withStyle';
import shadows from './shadows';
 
const modifyProps = ({ css, rize, size, theme, ...props }) => {
  const nextCss = {};
  if (rize && rize < shadows.length - 1) {
    Object.assign(nextCss, {
      boxShadow: shadows[rize],
    });
  }
  if (size) {
    const cssSize = `${size}px`;
    Object.assign(nextCss, { width: cssSize, height: cssSize });
  }
  return { element: 'div', ...props, css: { ...nextCss, ...css } };
};
 
const Paper = forwardRef((props, ref) => <Font atomRef={ref} {...modifyProps(props)} />);
 
Paper.displayName = 'Paper';
Paper.propTypes = {
  rize: PropTypes.number,
  size: PropTypes.number,
};
Paper.defaultProps = {
  rize: 0,
  size: 0,
};
 
export default withStyle(Paper);