@@ -4,7 +4,8 @@ import { useRouter } from 'next/navigation';
4
4
import HeartSvg from '@/components/svg-component/HeartSvg' ;
5
5
import clsx from 'clsx' ;
6
6
import { useMutationLike } from '@/hooks/useMutationLike' ;
7
- import { Dispatch , SetStateAction } from 'react' ;
7
+ import { Dispatch , SetStateAction , useCallback } from 'react' ;
8
+ import TTSPlayer from './TTSPlayer' ;
8
9
9
10
type Props = MainItemType & {
10
11
setIsOpenModal : Dispatch < SetStateAction < boolean > > ;
@@ -26,59 +27,46 @@ export default function WordItem({
26
27
setIsOpenModal,
27
28
} ) ;
28
29
29
- const handleLikeButton = ( ) => {
30
- isLike ? handleSubLike ( ) : handleAddLike ( ) ;
31
- } ;
30
+ const handleLikeButton = useCallback (
31
+ ( e : React . MouseEvent < HTMLButtonElement > ) => {
32
+ e . stopPropagation ( ) ;
33
+ isLike ? handleSubLike ( ) : handleAddLike ( ) ;
34
+ } ,
35
+ [ isLike , handleAddLike , handleSubLike ] ,
36
+ ) ;
32
37
33
38
return (
34
- < article
39
+ < div
35
40
key = { id }
36
- className = "min-h-[98px] p-[18px] pb-[14px] w-full ring-1 bg-white ring-[#F2F4F9] hover:ring-[#EFF2F7] rounded-2xl hover:bg-[#F1F4FA] hover:ring-2 cursor-pointer"
41
+ className = { clsx (
42
+ 'h-[120px] px-[18px] py-[16px] w-full ring-1 bg-white ring-[#F2F4F9] rounded-2xl cursor-pointer' ,
43
+ ) }
37
44
onClick = { ( ) => router . push ( getWordDetailPath ( name ) ) }
38
45
>
39
- < div className = "flex flex-col relative gap-1" >
40
- < div className = "flex justify-between items-center " >
41
- { /* 영단어, 단어 뜻, 발음 기호 컨테이너 */ }
42
- < div className = "flex flex-wrap items-center gap-2" >
43
- { /* 영단어 */ }
44
- < h3 className = "text-main-blue font-semibold text-[16px]" > { name } </ h3 >
45
-
46
- { /* 단어 뜻 */ }
47
- < div className = "text-main-charcoal break-words text-[14px] font-medium" >
48
- < span className = "mr-[2px] text-[#F2F4F9] font-extralight" > |</ span > { ' ' }
49
- { /* {pronunciation.join(', ')} */ }
50
- { /* FIXME: 여름과 논의 필요 */ }
51
- { pronunciation [ 0 ] }
52
- </ div >
46
+ < header className = "flex justify-between leading-[16px] mb-[5px]" >
47
+ < h3 className = "text-main-blue font-semibold text-[17px]" > { name } </ h3 >
48
+ < button
49
+ onClick = { handleLikeButton }
50
+ className = { clsx (
51
+ isLike ? 'text-main-blue' : 'text-[#DEE3F1]' ,
52
+ 'ml-[2px] mb-[3px]' ,
53
+ ) }
54
+ >
55
+ < HeartSvg />
56
+ </ button >
57
+ </ header >
53
58
54
- { /* 발음기호 */ }
55
- < p className = "text-[#858596] text-[11px] font-[300] -ml-[1px]" >
56
- { /* {diacritic.join(', ')} */ }
57
- { /* FIXME: 여름과 논의 필요 */ }
58
- { diacritic [ 0 ] }
59
- </ p >
60
- </ div >
61
-
62
- { /* 좋아요 버튼 */ }
59
+ < section className = "flex gap-1 items-center leading-[19px] mb-[6px]" >
60
+ < p className = "font-medium text-[14px] text-main-charcoal" >
61
+ { pronunciation [ 0 ] }
62
+ </ p >
63
63
64
- < button
65
- onClick = { ( e ) => {
66
- e . stopPropagation ( ) ;
67
- handleLikeButton ( ) ;
68
- } }
69
- className = { clsx ( isLike ? 'text-main-blue' : 'text-[#D3DAED]' ) }
70
- >
71
- < HeartSvg />
72
- </ button >
73
- </ div >
64
+ < TTSPlayer diacritic = { diacritic [ 0 ] . slice ( 1 , - 1 ) } id = { id } />
65
+ </ section >
74
66
75
- { /* 설명 */ }
76
- < p className = "text-main-gray text-[14px] font-[300] leading-[19px] line-clamp-1 xs:line-clamp-2" >
77
- { description }
78
- </ p >
79
- </ div >
80
- </ article >
67
+ < p className = "text-[14px] leading-[20px] text-main-gray line-clamp-2 tracking-[-2%] mt-[4px]" >
68
+ { description }
69
+ </ p >
70
+ </ div >
81
71
) ;
82
72
}
83
-
84
-
0 commit comments