Created
February 18, 2024 17:23
-
-
Save marekrozmus/2effd1bd66508776e6729128bb8be2e5 to your computer and use it in GitHub Desktop.
Responsive background react component usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mainDivRef = React.useRef<HTMLDivElement>(null); | |
... | |
<div | |
ref={mainDivRef} | |
className=" | |
bg-no-repeat | |
bg-contain | |
bg-center | |
h-48 w-96"> | |
<BackgroundSet | |
parentRef={mainDivRef} | |
mobileImageSrc={mobileBackground} | |
tabletImageSrc={tabletBackground} | |
desktopImageSrc={desktopBackground} | |
/> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment