import PropTypes from 'prop-types';
import React from 'react';

import childrenFromHtml from '../../childrenFromHtml';
import RichText from '../../RichText';

/* Interface */
const propTypes = {
  /** <RichText> content to render */
  content: PropTypes.string.isRequired,
};

/* Defaults */
const defaultProps = {
  content: '',
};

/**
 * Renders content from the `storyshare/quote` block
 * @private
 * @param {Object} props - React component props.
 * @returns {Object} React element.
 */
export const Quote = ({ content }) => (
  <blockquote>
    <RichText>
      { childrenFromHtml(content) }
    </RichText>
  </blockquote>
);

Quote.defaultProps = defaultProps;
Quote.propTypes = propTypes;

export default Quote;
