react-loader-spinner icon indicating copy to clipboard operation
react-loader-spinner copied to clipboard

How to make it Responsive

Open Yashesh133 opened this issue 1 year ago • 2 comments

Yashesh133 avatar Aug 22 '23 06:08 Yashesh133

How to make it Responsive

Yashesh133 avatar Aug 22 '23 06:08 Yashesh133

Hi @Yashesh133, to make your loading spinner responsive, you can adjust its dimensions based on the screen size using conditional rendering. Here's an example of how you can achieve this using the ThreeDots component:

// Define height and width based on screen size
const loaderHeight = window.innerWidth >= 992 ? "42" : "45";
const loaderWidth = window.innerWidth >= 992 ? "80" : "60"; 

return (
  <ThreeDots
    height={loaderHeight}
    width={loaderWidth}
    radius="9"
    color="rgba(0, 0, 0, .4)"
    ariaLabel="three-dots-loading"
    wrapperStyle={{}} 
    visible={true}
  />
);

I hope it helps you!

J-Zam avatar Sep 02 '23 21:09 J-Zam