import React from 'react'
import PropTypes from 'prop-types';
import sy from './title-text.module.scss'
import { css, cx } from '@emotion/css'
import classNames from 'classnames'

const TitleText = (props) => {
  const {
    children,
    tagColor,
    color,
    fontSize,
    fontWeight,
    textTransform,
    marginBottom,
  } = props

  if (!children) {
    return null
  }


  return (
    <div
      className={classNames(css`
      position: relative;
      display: flex;
      flex-direction: row;
      height: auto;
      margin-bottom: ${marginBottom}px;
      /* &:hover {
        color: ${color};
      } */
      `,
        sy.boxTitleText,
      )}
    >
      <div
        className={css`
        display: flex;
        flex-direction: row;
        height: auto;
        background-color: ${tagColor};
        width: 6px;
        margin-right: 8px;
        `}
      />
      <h1
        data-testid="title"
        className={css`
        color:${color};
        font-size:${fontSize};
        font-weight:${fontWeight};
        text-transform:${textTransform};
        margin: 0;
        `}
      >
        {children}
      </h1>

    </div>
  )
}

TitleText.propTypes = {
  children: PropTypes.any,
  tagColor: PropTypes.string,
  color: PropTypes.string,
  fontSize: PropTypes.string,
  fontWeight: PropTypes.any,
  textTransform: PropTypes.any,
  marginBottom: PropTypes.number,
};

TitleText.defaultProps = {
  children: '',
  tagColor: '#1DCAB4',
  color: '#2A2C2D',
  fontSize: '16px',
  fontWeight: 'normal',
  textTransform: 'none',
  marginBottom: 0,
};


export default TitleText


