diff --git a/components/image/figure.js b/components/image/figure.js new file mode 100644 index 00000000..e60c68a7 --- /dev/null +++ b/components/image/figure.js @@ -0,0 +1,25 @@ +import PropTypes from 'prop-types'; +import { StyledComponentContext } from '../styled-components-context'; +import { InlineControlsStyleWrapper } from './styles'; + +export const Figure = (props) => { + const { style, children, ...rest } = props; + + return ( + + + {children} + + + ); +}; + +Figure.defaultProps = { + style: {}, + children: [], +}; + +Figure.propTypes = { + style: PropTypes.object, + children: PropTypes.array, +}; diff --git a/components/image/index.js b/components/image/index.js index d86574e6..4f72c280 100644 --- a/components/image/index.js +++ b/components/image/index.js @@ -5,10 +5,10 @@ import PropTypes from 'prop-types'; /** * Internal Dependencies */ -import { StyledComponentContext } from '../styled-components-context'; + import { Media, ImageContext } from './media'; +import { Figure } from './figure'; import { InlineControls } from './inline-controls'; -import { InlineControlsStyleWrapper } from './styles'; import { useMedia } from '../../hooks/use-media'; const ImageWrapper = (props) => { @@ -154,25 +154,3 @@ ImageWrapper.propTypes = { onRemove: PropTypes.func, children: PropTypes.array, }; - -const Figure = (props) => { - const { style, children, ...rest } = props; - - return ( - - - {children} - - - ); -}; - -Figure.defaultProps = { - style: {}, - children: [], -}; - -Figure.propTypes = { - style: PropTypes.object, - children: PropTypes.array, -}; diff --git a/example/src/blocks/multiple-image-example/edit.js b/example/src/blocks/multiple-image-example/edit.js index 38add3dc..36bd382b 100644 --- a/example/src/blocks/multiple-image-example/edit.js +++ b/example/src/blocks/multiple-image-example/edit.js @@ -22,7 +22,8 @@ export function BlockEdit(props) { className="example-image" focalPoint={focalPoint1} onChangeFocalPoint={(value) => setAttributes({focalPoint1: value})} - hasInlineControls={true} onRemove={() => setAttributes({image1: null})} + hasInlineControls={true} + onRemove={() => setAttributes({image1: null})} isOptional={false} /> @@ -33,7 +34,8 @@ export function BlockEdit(props) { className="example-image" focalPoint={focalPoint2} onChangeFocalPoint={(value) => setAttributes({focalPoint2: value})} - hasInlineControls={true} onRemove={() => setAttributes({image2: null})} + hasInlineControls={true} + onRemove={() => setAttributes({image2: null})} /> setAttributes({focalPoint3: value})} - hasInlineControls={true} onRemove={() => setAttributes({image3: null})} + hasInlineControls={true} + onRemove={() => setAttributes({image3: null})} /> )