11"use client" ;
22
33import { useRouter } from "next/navigation" ;
4- import { useEffect , useMemo , useRef , useState } from "react" ;
4+ import { type FormEvent , useEffect , useMemo , useRef , useState } from "react" ;
55import { useGetApplicationsList } from "@/apis/applications" ;
66import ConfirmCancelModal from "@/components/modal/ConfirmCancelModal" ;
77import ButtonTab from "@/components/ui/ButtonTab" ;
88import Tab from "@/components/ui/Tab" ;
99import { REGIONS_KO } from "@/constants/university" ;
1010import type { ScoreSheet as ScoreSheetType } from "@/types/application" ;
1111import type { RegionKo } from "@/types/university" ;
12+ import ApplicationSectionTitle from "./_components/ApplicationSectionTitle" ;
1213import ScoreSearchBar from "./ScoreSearchBar" ;
14+ import ScoreSearchField from "./ScoreSearchField" ;
1315import ScoreSheet from "./ScoreSheet" ;
1416
1517const PREFERENCE_CHOICE : ( "1순위" | "2순위" | "3순위" ) [ ] = [ "1순위" , "2순위" , "3순위" ] ;
@@ -79,7 +81,7 @@ const ScorePageContent = () => {
7981 } , [ scoreResponseData , regionFilter , searchValue ] ) ;
8082
8183 // (이하 코드는 동일)
82- const handleSearch = ( event : React . FormEvent ) => {
84+ const handleSearch = ( event : FormEvent ) => {
8385 event . preventDefault ( ) ;
8486 const keyword = searchRef . current ?. value || "" ;
8587 setRegionFilter ( "" ) ;
@@ -91,6 +93,9 @@ const ScorePageContent = () => {
9193 if ( searchRef . current ) {
9294 searchRef . current . value = keyword ;
9395 }
96+ setRegionFilter ( "" ) ;
97+ setSearchValue ( keyword ) ;
98+ setSearchActive ( false ) ;
9499 } ;
95100
96101 const handleSearchClick = ( ) => {
@@ -121,35 +126,23 @@ const ScorePageContent = () => {
121126 const hotKeyWords = [ "RMIT" , "오스트라바" , "칼스루에" , "그라츠" , "추오" , "프라하" , "보라스" , "빈" , "메모리얼" ] ;
122127
123128 return (
124- < div className = "gap-4 px-5" >
129+ < div className = "px-5" >
130+ < ApplicationSectionTitle
131+ className = "mb-3 mt-5"
132+ title = "지원자 현황"
133+ description = "지원 순위와 지역 필터로 원하는 학교 현황을 빠르게 확인할 수 있어요."
134+ />
125135 < ScoreSearchBar onClick = { handleSearchClick } textRef = { searchRef } searchHandler = { handleSearch } />
126136
127137 { searchActive ? (
128- < div className = "p-4 font-sans" >
129- { /* Title for the popular searches section */ }
130- < div className = "ml-5 mt-[18px] text-black typo-sb-7" > 인기 검색</ div >
131-
132- { /* Container for the keyword buttons */ }
133- < div className = "ml-5 mt-2.5 flex flex-wrap gap-2" >
134- { hotKeyWords . map ( ( word ) => (
135- < button
136- key = { word }
137- // Button styling for each keyword
138- className = "flex items-center justify-center gap-2.5 rounded-full bg-k-50 px-3 py-[5px] text-black transition-colors typo-medium-2 hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2"
139- onClick = { ( ) => {
140- handleSearchField ( word ) ;
141- handleSearch ( new Event ( "submit" ) as unknown as React . FormEvent ) ;
142- } }
143- type = "button"
144- >
145- { word }
146- </ button >
147- ) ) }
148- </ div >
138+ < div className = "mt-3 rounded-lg bg-white py-4 shadow-sdwB" >
139+ < ScoreSearchField keyWords = { hotKeyWords } setKeyWord = { handleSearchField } />
149140 </ div >
150141 ) : (
151142 < >
152- < Tab choices = { PREFERENCE_CHOICE } choice = { preference } setChoice = { setPreference } />
143+ < div className = "mt-4 rounded-lg bg-white px-2 shadow-sdwB" >
144+ < Tab choices = { PREFERENCE_CHOICE } choice = { preference } setChoice = { setPreference } />
145+ </ div >
153146 < ButtonTab
154147 choices = { REGIONS_KO }
155148 choice = { regionFilter }
@@ -158,10 +151,10 @@ const ScorePageContent = () => {
158151 setSearchValue ( "" ) ;
159152 setRegionFilter ( newRegion as RegionKo | "" ) ;
160153 } }
161- style = { { padding : "10px 0 10px 18px " } }
154+ style = { { padding : "10px 0 10px 8px " } }
162155 />
163156
164- < div className = "mx-auto mt-2.5 flex w-full flex-col gap-3 overflow-x-auto" >
157+ < div className = "mx-auto mt-3 flex w-full flex-col gap-3 overflow-x-auto pb-4 " >
165158 { scoreSheets . map ( ( choice ) => (
166159 < ScoreSheet key = { choice . koreanName } scoreSheet = { choice } />
167160 ) ) }
0 commit comments