1
- " use client" ;
2
- import Image from " next/image" ;
3
- import React , { useEffect , useId , useRef , useState } from " react" ;
4
- import { AnimatePresence , motion } from " framer-motion" ;
5
- import { useOutsideClick } from " @/hooks/use-outside-click" ;
1
+ ' use client' ;
2
+ import Image from ' next/image' ;
3
+ import React , { useEffect , useId , useRef , useState } from ' react' ;
4
+ import { AnimatePresence , motion } from ' framer-motion' ;
5
+ import { useOutsideClick } from ' @/hooks/use-outside-click' ;
6
6
7
7
export default function ExpandableCardDemo ( ) {
8
8
const [ active , setActive ] = useState < ( typeof cards ) [ number ] | boolean | null > (
@@ -13,27 +13,27 @@ export default function ExpandableCardDemo() {
13
13
14
14
useEffect ( ( ) => {
15
15
function onKeyDown ( event : KeyboardEvent ) {
16
- if ( event . key === " Escape" ) {
16
+ if ( event . key === ' Escape' ) {
17
17
setActive ( false ) ;
18
18
}
19
19
}
20
20
21
- if ( active && typeof active === " object" ) {
22
- document . body . style . overflow = " hidden" ;
21
+ if ( active && typeof active === ' object' ) {
22
+ document . body . style . overflow = ' hidden' ;
23
23
} else {
24
- document . body . style . overflow = " auto" ;
24
+ document . body . style . overflow = ' auto' ;
25
25
}
26
26
27
- window . addEventListener ( " keydown" , onKeyDown ) ;
28
- return ( ) => window . removeEventListener ( " keydown" , onKeyDown ) ;
27
+ window . addEventListener ( ' keydown' , onKeyDown ) ;
28
+ return ( ) => window . removeEventListener ( ' keydown' , onKeyDown ) ;
29
29
} , [ active ] ) ;
30
30
31
31
useOutsideClick ( ref , ( ) => setActive ( null ) ) ;
32
32
33
33
return (
34
34
< >
35
35
< AnimatePresence >
36
- { active && typeof active === " object" && (
36
+ { active && typeof active === ' object' && (
37
37
< motion . div
38
38
initial = { { opacity : 0 } }
39
39
animate = { { opacity : 1 } }
@@ -43,7 +43,7 @@ export default function ExpandableCardDemo() {
43
43
) }
44
44
</ AnimatePresence >
45
45
< AnimatePresence >
46
- { active && typeof active === " object" ? (
46
+ { active && typeof active === ' object' ? (
47
47
< div className = "fixed inset-0 grid place-items-center z-[100]" >
48
48
< motion . button
49
49
key = { `button-${ active . title } -${ id } ` }
@@ -115,7 +115,7 @@ export default function ExpandableCardDemo() {
115
115
exit = { { opacity : 0 } }
116
116
className = "text-neutral-600 text-xs md:text-sm lg:text-base h-40 md:h-fit pb-10 flex flex-col items-start gap-4 overflow-auto dark:text-neutral-400 [mask:linear-gradient(to_bottom,white,white,transparent)] [scrollbar-width:none] [-ms-overflow-style:none] [-webkit-overflow-scrolling:touch]"
117
117
>
118
- { typeof active . content === " function"
118
+ { typeof active . content === ' function'
119
119
? active . content ( )
120
120
: active . content }
121
121
</ motion . div >
@@ -206,11 +206,11 @@ export const CloseIcon = () => {
206
206
207
207
const cards = [
208
208
{
209
- description : " Lana Del Rey" ,
210
- title : " Summertime Sadness" ,
211
- src : " https://assets.aceternity.com/demos/lana-del-rey.jpeg" ,
212
- ctaText : " Play" ,
213
- ctaLink : " https://ui.aceternity.com/templates" ,
209
+ description : ' Lana Del Rey' ,
210
+ title : ' Summertime Sadness' ,
211
+ src : ' https://assets.aceternity.com/demos/lana-del-rey.jpeg' ,
212
+ ctaText : ' Play' ,
213
+ ctaLink : ' https://ui.aceternity.com/templates' ,
214
214
content : ( ) => {
215
215
return (
216
216
< p >
@@ -229,11 +229,11 @@ const cards = [
229
229
} ,
230
230
} ,
231
231
{
232
- description : " Babbu Maan" ,
233
- title : " Mitran Di Chhatri" ,
234
- src : " https://assets.aceternity.com/demos/babbu-maan.jpeg" ,
235
- ctaText : " Play" ,
236
- ctaLink : " https://ui.aceternity.com/templates" ,
232
+ description : ' Babbu Maan' ,
233
+ title : ' Mitran Di Chhatri' ,
234
+ src : ' https://assets.aceternity.com/demos/babbu-maan.jpeg' ,
235
+ ctaText : ' Play' ,
236
+ ctaLink : ' https://ui.aceternity.com/templates' ,
237
237
content : ( ) => {
238
238
return (
239
239
< p >
@@ -252,11 +252,11 @@ const cards = [
252
252
} ,
253
253
254
254
{
255
- description : " Metallica" ,
256
- title : " For Whom The Bell Tolls" ,
257
- src : " https://assets.aceternity.com/demos/metallica.jpeg" ,
258
- ctaText : " Play" ,
259
- ctaLink : " https://ui.aceternity.com/templates" ,
255
+ description : ' Metallica' ,
256
+ title : ' For Whom The Bell Tolls' ,
257
+ src : ' https://assets.aceternity.com/demos/metallica.jpeg' ,
258
+ ctaText : ' Play' ,
259
+ ctaLink : ' https://ui.aceternity.com/templates' ,
260
260
content : ( ) => {
261
261
return (
262
262
< p >
@@ -274,11 +274,11 @@ const cards = [
274
274
} ,
275
275
} ,
276
276
{
277
- description : " Led Zeppelin" ,
278
- title : " Stairway To Heaven" ,
279
- src : " https://assets.aceternity.com/demos/led-zeppelin.jpeg" ,
280
- ctaText : " Play" ,
281
- ctaLink : " https://ui.aceternity.com/templates" ,
277
+ description : ' Led Zeppelin' ,
278
+ title : ' Stairway To Heaven' ,
279
+ src : ' https://assets.aceternity.com/demos/led-zeppelin.jpeg' ,
280
+ ctaText : ' Play' ,
281
+ ctaLink : ' https://ui.aceternity.com/templates' ,
282
282
content : ( ) => {
283
283
return (
284
284
< p >
@@ -295,11 +295,11 @@ const cards = [
295
295
} ,
296
296
} ,
297
297
{
298
- description : " Mustafa Zahid" ,
299
- title : " Toh Phir Aao" ,
300
- src : " https://assets.aceternity.com/demos/toh-phir-aao.jpeg" ,
301
- ctaText : " Play" ,
302
- ctaLink : " https://ui.aceternity.com/templates" ,
298
+ description : ' Mustafa Zahid' ,
299
+ title : ' Toh Phir Aao' ,
300
+ src : ' https://assets.aceternity.com/demos/toh-phir-aao.jpeg' ,
301
+ ctaText : ' Play' ,
302
+ ctaLink : ' https://ui.aceternity.com/templates' ,
303
303
content : ( ) => {
304
304
return (
305
305
< p >
0 commit comments