Skip to content

Conversation

@Katotodan
Copy link
Contributor

Description
This PR fixes a rendering issue in the SoSpecial carousel where slider items were shrinking on small devices.
The root cause was related to Gatsby’s SSR behavior: the slider was initially rendered on the server without access to viewport-dependent values used in the slider settings (inside settings > responsive array), causing react-slick to compute incorrect dimensions.
To fix this, SSR rendering was kind of disabled for this specific component, and the slider settings are now adjusted programmatically on the client based on the current screen size. This ensures consistent and stable rendering across all breakpoints.

This PR fixes #7305

Here is the picture before
PHOTO-2025-12-29-01-42-42

After
Screenshot 2025-12-29 at 21 09 08

Notes for Reviewers

Signed commits

  • [x ] Yes, I signed my commits.

@l5io
Copy link
Contributor

l5io commented Dec 29, 2025

🚀 Preview for commit f83e56c at: https://6952c83dfa81b7936b9b64b4--layer5.netlify.app

Copy link
Contributor

@kishore08-07 kishore08-07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Katotodan

Text is overlapping, Adjust the card width and layout for smaller screens to ensure proper content spacing.

1000241179

Copy link
Contributor

@kishore08-07 kishore08-07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Katotodan
Use the Related Resources section on https://layer5.io/solutions/platform-engineering as the reference for the expected behavior.
1000241180

@l5io
Copy link
Contributor

l5io commented Dec 31, 2025

🚀 Preview for commit 013f035 at: https://69550b75eb2fb35344b02635--layer5.netlify.app

@Katotodan
Copy link
Contributor Author

@kishore08-07 Can you take a look please?

Copy link
Contributor

@kishore08-07 kishore08-07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert !important.

@l5io
Copy link
Contributor

l5io commented Dec 31, 2025

🚀 Preview for commit 8c1d98d at: https://69552fdd914961d5ff8e4ef8--layer5.netlify.app

@Katotodan
Copy link
Contributor Author

@kishore08-07 I have done so, please review

display: block;
text-align: center;
margin: auto;
object-fit: fill !important;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert !important.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kishore08-07 The Image has object-fit set to cover by default.
That was done inside src/components/image.js

import { GatsbyImage } from "gatsby-plugin-image";

const Image = ({ childImageSharp, extension, publicURL, alt, imgStyle, ...rest }) => {

  if (!childImageSharp && extension === "svg") {
    return (
      <div className="old-gatsby-image-wrapper" style={{ width: "100%", height: "auto" }}>
        <img
          src={publicURL}
          alt={alt || "Blog image"}
          width="100%"
          height="auto"
          style={{
            objectFit: imgStyle?.objectFit || "cover",
            ...imgStyle
          }}
        />
      </div>
    );
  }

  return <GatsbyImage
    key={publicURL}
    image={childImageSharp?.gatsbyImageData}
    alt={alt || "Blog image"}
    style={{
      objectFit: imgStyle?.objectFit || "cover",
    }}
    {...rest}
  />;
};

export default Image;

Removing that !important on that line of code is making the default one to win. And the images are not showing well anymore after removing that !important. What do you think?

Copy link
Contributor Author

@Katotodan Katotodan Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mr. @kishore08-07 , what is your thought? And seems like Gatsby generate "img" with inline styles, among them object-fit set to cover. So removing that !important make Gatsby image inline style to win.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the Image component uses object-fit: cover by default, the !important makes sense here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kishore08-07 thank you for the review

Copy link
Member

@Rajesh-Nagarajan-11 Rajesh-Nagarajan-11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks.

@l5io
Copy link
Contributor

l5io commented Jan 5, 2026

🚀 Preview for commit 14617ca at: https://695bd248842366cbd115c499--layer5.netlify.app

@l5io
Copy link
Contributor

l5io commented Jan 6, 2026

🚀 Preview for commit 225289d at: https://695d31102932d09ca67b6f85--layer5.netlify.app

@Katotodan
Copy link
Contributor Author

@Rajesh-Nagarajan-11 thanks for reviewing my PR!
Please let me know if there’s anything else needed from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fixing slider on small devices

4 participants