From 884534c685f3385e5679ea36b3fed9428ce0a00d Mon Sep 17 00:00:00 2001 From: Eric Jinks Date: Thu, 3 May 2018 13:18:38 +1000 Subject: [PATCH] Add optional src prop to component --- src/components/Content.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/components/Content.js b/src/components/Content.js index 601e8b7..f605c71 100644 --- a/src/components/Content.js +++ b/src/components/Content.js @@ -1,5 +1,6 @@ import React from 'react' import Marked from 'react-markdown' +import PropTypes from 'prop-types' import { getImageSrc, getImageSrcset } from '../util/getImageUrl' import './Content.css' @@ -13,17 +14,6 @@ const encodeMarkdownURIs = (source = '') => { }) } -export default ({ source, className = '' }) => ( - -) - const ImageWithSrcset = ({ nodeKey, src, alt, ...props }) => { const decodedSrc = decodeURI(src) return ( @@ -48,3 +38,22 @@ const HtmlBlock = ({ value }) => { /> ) } + +const Content = ({ source, src, className = '' }) => ( + +) + +Content.propTypes = { + source: PropTypes.string, + src: PropTypes.string, + className: PropTypes.string +} + +export default Content