From 38c224f10a16dd117ca7a3be31b5c3840203ca03 Mon Sep 17 00:00:00 2001 From: Danny Wilson Date: Tue, 13 Feb 2018 17:00:41 -0400 Subject: [PATCH] Allow specifying which html tag will be used for gatsby-image wrappers --- packages/gatsby-image/src/index.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/gatsby-image/src/index.js b/packages/gatsby-image/src/index.js index 7100366fd0685..94b485d52662f 100644 --- a/packages/gatsby-image/src/index.js +++ b/packages/gatsby-image/src/index.js @@ -187,6 +187,7 @@ class Image extends React.Component { sizes, resolutions, backgroundColor, + Tag, } = convertProps(this.props) let bgColor @@ -207,7 +208,7 @@ class Image extends React.Component { // The outer div is necessary to reset the z-index to 0. return ( -
-
{/* Preserve the aspect ratio. */} -
-
-
+ + ) } @@ -327,7 +328,7 @@ class Image extends React.Component { // The outer div is necessary to reset the z-index to 0. return ( -
-
-
-
+ + ) } @@ -421,6 +422,7 @@ class Image extends React.Component { Image.defaultProps = { fadeIn: true, alt: ``, + Tag: `div`, } Image.propTypes = { @@ -440,6 +442,7 @@ Image.propTypes = { position: PropTypes.string, backgroundColor: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), onLoad: PropTypes.func, + Tag: PropTypes.string, } export default Image