File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1+ import { createEffect } from "solid-js"
12import Button from "~/shared/ui/Button"
23import Price from "~/shared/ui/Price"
34
45export type Props = { title : string ; timer : string ; bid : number ; img : string }
56
67const Card = ( props : Props ) => {
8+ let ref : HTMLImageElement
9+
10+ createEffect ( ( ) => {
11+ const options = { }
12+ const observer = new IntersectionObserver ( ( entries , observer ) => {
13+ for ( const entry of entries ) {
14+ if ( entry . isIntersecting ) {
15+ ref ! . style . visibility = "visible"
16+ } else {
17+ ref ! . style . visibility = "hidden"
18+ }
19+ }
20+ } , options )
21+ observer . observe ( ref ! )
22+ } )
23+
724 return (
825 < div class = "p-[10px] xl:p-[14px] flex flex-col bg-white w-[200px] xl:w-[280px] rounded-3xl gap-[18px]" >
926 < div class = "relative aspect-square w-full" >
1027 < img
28+ ref = { ref ! }
1129 src = { `/divesea/images/${ props . img } ` }
1230 class = "object-cover w-full aspect-square rounded-3xl"
1331 loading = "lazy"
You can’t perform that action at this time.
0 commit comments