@@ -14,8 +14,7 @@ import useClickOutside from '@hooks/useClickOutside';
1414type Suggestion = {
1515 id : string ;
1616 title : string ;
17- abstract : string ;
18- year : string ;
17+ authorsYear : string ;
1918} ;
2019
2120export default function Search ( {
@@ -54,6 +53,7 @@ export default function Search({
5453
5554 setQuery ( '' ) ;
5655 setSuggestions ( [ ] ) ;
56+ setModalOpen ( false ) ;
5757 setStatus ( 'Fetching paper...' ) ;
5858 const paper = await fetchFromSemanticScholar ( id ) ;
5959
@@ -99,7 +99,7 @@ export default function Search({
9999
100100 return (
101101 < >
102- < div className = 'search flex items-center justify-between' >
102+ < div className = 'search flex items-center justify-between w-full ' >
103103 < button
104104 onClick = { ( ) => setModalOpen ( true ) }
105105 className = "p-2 rounded-full bg-gray-100 hover:bg-gray-200"
@@ -113,25 +113,16 @@ export default function Search({
113113
114114
115115 { modalOpen && (
116- < div className = "fixed inset-0 z-50 bg-black/40 flex items-center justify-center" >
117- < div ref = { ref } className = "bg-white rounded-lg shadow-lg w-full max-w-md p-4 relative" >
118- < button
119- onClick = { ( ) => setModalOpen ( false ) }
120- className = "absolute top-2 right-3 text-gray-400 hover:text-gray-600 text-xl"
121- >
122- ×
123- </ button >
124-
116+ < div className = "fixed inset-0 z-200 bg-black/40 flex items-center justify-center" >
117+ < div ref = { ref } className = "bg-white rounded-lg shadow-lg w-[50%] p-4 relative" >
125118 < h2 className = "text-lg font-semibold mb-1" > Search Paper</ h2 >
126- < p className = "text-sm text-gray-500 mb-3" > { status } </ p >
127-
128119 < input
129120 type = "search"
130121 value = { query }
131122 placeholder = "Type paper title and press Enter..."
132123 onChange = { ( e ) => setQuery ( e . target . value ) }
133124 onKeyDown = { ( e ) => e . key === 'Enter' && handleSearch ( ) }
134- className = "border p-2 w-full rounded mb-2"
125+ className = "border p-2 w-full rounded mb-2 text-[20px] "
135126 autoFocus
136127 />
137128
@@ -140,17 +131,22 @@ export default function Search({
140131 : suggestions . length === 0 && query . trim ( ) !== '' ? (
141132 searched && < p className = "text-sm text-gray-500 mt-2" > No results</ p >
142133 ) : (
143- < ul className = "border max-h-60 overflow-auto rounded bg-white " >
134+ < ul className = " max-h-60 overflow-auto" >
144135 { suggestions . map ( ( s ) => (
145136 < li
146137 key = { s . id }
147138 className = { `p-2 ${ knownIds . has ( s . id )
148139 ? 'bg-gray-100 text-gray-400 cursor-default'
149140 : 'hover:bg-blue-100 cursor-pointer'
150- } `}
141+ } border-b-[1px] border-b-gray-200 `}
151142 onClick = { ( ) => ! knownIds . has ( s . id ) && handleSelect ( s . id ) }
152143 >
153- { s . title }
144+ < div className = 'text-[14px]' >
145+ { s . title }
146+ </ div >
147+ < div className = 'text-[12px]' >
148+ { s . authorsYear }
149+ </ div >
154150 </ li >
155151 ) ) }
156152 </ ul >
0 commit comments