All files / Text Text.jsx

100% Statements 16/16
50% Branches 2/4
100% Functions 1/1
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 22 23 24 251x 1x   1x   1x   1x   1x   1x 1x   1x 2x 2x   2x 2x 2x 2x   2x  
import React from 'react';
import PropTypes from 'prop-types';
 
Text.propTypes = {
  /** font-tiny5|font-shantell-sans|font-urbanist */
  className: PropTypes.string,
  /** could be string. */
  children: PropTypes.node,
  /** expects string values, should look into html content... */
  content: PropTypes.string,
  /** expecting string representation of tag names */
  tagName: PropTypes.string
};
 
export function Text({ className, children = 'I am a Text Component! Give me content.', content = '', tagName = 'span', ...props }) {
  const childs = content || children;
  const Tag = tagName;
 
  return (
    <Tag className={className} data-ui="text" {...props}>
      {childs}
    </Tag>
  );
}