Skip to content

Commit edcf2fd

Browse files
Cup0fCoffeejsnwesson
authored andcommitted
fix: course image height on IOS Safari
Course thumbnails on IOS Safari stretch to the full height of the image, instead of being limited by width and preserving aspect ratio. This seems to be a IOS Safari specific behavior[1]. Learner dashboard MFE uses a custom implementation of CourseCardImage, because the one in Paragon currently doesn't allow the image to be clickable. Because of that, we are fixing this issue in this repo for now, instead of fixing it in Paragon, until Paragon updates their implementation and this repo is updated to use a newer version of Paragon. 1: https://stackoverflow.com/a/44250830
1 parent 9228d01 commit edcf2fd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/containers/CourseCard/components/CourseCardImage.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ export const CourseCardImage = ({ cardId, orientation }) => {
2020
const { isVerified } = reduxHooks.useCardEnrollmentData(cardId);
2121
const { disableCourseTitle } = useActionDisabledState(cardId);
2222
const handleImageClicked = reduxHooks.useTrackCourseEvent(courseImageClicked, cardId, homeUrl);
23-
const wrapperClassName = `pgn__card-wrapper-image-cap overflow-visible ${orientation}`;
23+
const wrapperClassName = `pgn__card-wrapper-image-cap d-inline-block overflow-visible ${orientation}`;
2424
const image = (
2525
<>
2626
<img
27-
className="pgn__card-image-cap show"
27+
// w-100 is necessary for images on Safari, otherwise stretches full height of the image
28+
// https://stackoverflow.com/a/44250830
29+
className="pgn__card-image-cap w-100 show"
2830
src={bannerImgSrc}
2931
alt={formatMessage(messages.bannerAlt)}
3032
/>

0 commit comments

Comments
 (0)