From 59154522ab1f3a7dd88e3239110afacca42be54b Mon Sep 17 00:00:00 2001 From: Lucas Cordeiro Date: Mon, 9 Mar 2020 16:06:10 -0300 Subject: [PATCH] add prop width to image block --- CHANGELOG.md | 2 ++ react/Image.tsx | 8 ++++++-- react/package.json | 2 +- react/yarn.lock | 8 ++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a00ffa00..3b07d403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Prop `width` to `product-list-image` block. ## [0.18.1] - 2020-03-09 ### Changed diff --git a/react/Image.tsx b/react/Image.tsx index 33c28200..ad55f650 100644 --- a/react/Image.tsx +++ b/react/Image.tsx @@ -30,7 +30,11 @@ const CSS_HANDLES = [ 'productImage', ] as const -const Image: FunctionComponent = () => { +interface ImageProps { + width?: number +} + +const Image: FunctionComponent = ({ width = 96 }) => { const { item, loading } = useItemContext() const handles = useCssHandles(CSS_HANDLES) @@ -46,7 +50,7 @@ const Image: FunctionComponent = () => { className={`${handles.productImageContainer} ${opaque( item.availability )}`} - style={{ width: '96px' }} + style={{ width }} >