@@ -31,6 +31,22 @@ const Card: React.FC<CardProps> = ({
3131 togglePlayback ( ) ;
3232 } ;
3333
34+ const PronunciationButton = ( ) => {
35+ if ( ! PronounciationUrl ) {
36+ return null ;
37+ }
38+
39+ return (
40+ < button
41+ type = "button"
42+ onClick = { handlePronunciation }
43+ className = "absolute right-4 bottom-4 z-10 text-white"
44+ >
45+ < FontAwesomeIcon icon = { faVolumeHigh } />
46+ </ button >
47+ ) ;
48+ } ;
49+
3450 return (
3551 < div className = "relative rounded-2xl overflow-hidden shadow-2xl w-[300px] h-[400px] sm:w-[300px] sm:h-[400px] md:w-[350px] md:h-[450px] lg:w-[519px] lg:h-[600px]" >
3652 { /* Front View */ }
@@ -60,14 +76,7 @@ const Card: React.FC<CardProps> = ({
6076 < p className = "text-lg text-white sm:text-lg md:text-xl lg:text-2xl" >
6177 { Pronunciation }
6278 </ p >
63- { PronounciationUrl && (
64- < button
65- onClick = { handlePronunciation }
66- className = "absolute right-4 bottom-4 z-10 text-white"
67- >
68- < FontAwesomeIcon icon = { faVolumeHigh } />
69- </ button >
70- ) }
79+ < PronunciationButton />
7180 </ div >
7281 < div className = "relative w-full h-[30%] rounded-b-2xl overflow-hidden flex items-center justify-center" >
7382 { ImageUrl && (
@@ -113,14 +122,7 @@ const Card: React.FC<CardProps> = ({
113122 < p className = "text-lg sm:text-lg md:text-xl lg:text-2xl" >
114123 { Pronunciation }
115124 </ p >
116- { PronounciationUrl && (
117- < button
118- onClick = { handlePronunciation }
119- className = "absolute right-4 bottom-4 z-10 text-white"
120- >
121- < FontAwesomeIcon icon = { faVolumeHigh } />
122- </ button >
123- ) }
125+ < PronunciationButton />
124126 </ div >
125127 < div className = "relative h-[70%] w-full rounded-b-2xl overflow-hidden flex items-center justify-center" >
126128 { ImageUrl && (
0 commit comments