Skip to content

Commit ff47801

Browse files
ClementNumericitegarronej
authored andcommitted
fix: add imageWidth & imageHeight properties on Tile (#108)
The proposed change for the Tile component involves adding a feature to specify the width and height of the optional image. I added imageWidth & imageHeight optionnal properties to follow the imageUrl & imageAlt pattern. I'll make another suggestion : introduce an imageProps object, similar to the existing linkProps object, which would provide greater flexibility and control over the image properties. I am open to discussing this further. Signed-off-by: Clément Lelong <clement@numericite.eu>
1 parent 0f5a95c commit ff47801

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Tile.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export type TileProps = {
1515
desc?: ReactNode;
1616
imageUrl?: string;
1717
imageAlt?: string;
18+
imageWidth?: string | number;
19+
imageHeight?: string | number;
1820
grey?: boolean;
1921

2022
/** make the whole tile clickable */
@@ -39,6 +41,8 @@ export const Tile = memo(
3941
desc,
4042
imageUrl,
4143
imageAlt,
44+
imageWidth,
45+
imageHeight,
4246
horizontal = false,
4347
grey = false,
4448
classes = {},
@@ -88,6 +92,8 @@ export const Tile = memo(
8892
className={cx(fr.cx("fr-responsive-img"), classes.imgTag)}
8993
src={imageUrl}
9094
alt={imageAlt}
95+
width={imageWidth}
96+
height={imageHeight}
9197
/>
9298
</div>
9399
)) ||

0 commit comments

Comments
 (0)