/**
*
* IKText
*
*/

import React, { PureComponent } from 'react';


class IKText extends PureComponent { // eslint-disable-line react/prefer-stateless-function
  static propTypes = {
    label: React.PropTypes.string,
    text: React.PropTypes.string,
    button: React.PropTypes.string,
    buttonEvent: React.PropTypes.func,
  };

  constructor(props) {
    super(props);
  }

  render() {
    const props = $({}, this.props);
    let svgElm = null;

    if (props.button) {
      props.style = { width: '80%' };

      svgElm = (
        <svg>
          <use xlinkHref={props.button} onClick={props.buttonEvent} />
        </svg>
      );
    }

    return (
      <div className="ikmd-text">
        <label className='shrunken'>{props.label}</label>
        <span>{props.text}</span>
        {svgElm}
      </div>
    );
  }
}

export default IKText;
