Skip to content

Commit

Permalink
feat(objecttile): L3-4753 accept srcset & sizes from object tile (#447)
Browse files Browse the repository at this point in the history
Co-authored-by: Sam Grund <[email protected]>
  • Loading branch information
sgrund14 and Sam Grund authored Dec 10, 2024
1 parent 48ed16b commit dfd959f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/patterns/ObjectTile/ObjectTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export interface ObjectTileProps extends ComponentProps<'a'> {
* Image URL for the object.
*/
imageUrl?: string;
/**
* Image srcset for the object. [https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset]
*/
imageSrcSet?: string;
/**
* Image sizes for the object. [https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes]
*/
imageSizes?: string;
/**
* Object Lot number.
*/
Expand Down Expand Up @@ -82,6 +90,8 @@ const ObjectTile = forwardRef<HTMLAnchorElement, ObjectTileProps>(
favoriteElement: FavoriteElement,
imageAlt = 'Brought to you by Phillips',
imageUrl = '',
imageSrcSet,
imageSizes,
lotNumber,
makerText,
modelText,
Expand All @@ -102,6 +112,8 @@ const ObjectTile = forwardRef<HTMLAnchorElement, ObjectTileProps>(
className={`${baseClassName}__img`}
objectFit="cover"
src={imageUrl}
srcSet={imageSrcSet}
sizes={imageSizes}
/>
{!withdrawnText ? (
<Text className={`${baseClassName}__badge`} variant={TextVariants.badge}>
Expand Down

0 comments on commit dfd959f

Please sign in to comment.