11import { DAY_TO_JAPANESE_MAP } from "common/consts" ;
22import type { Course , Day } from "common/types" ;
33import { useEffect , useState } from "react" ;
4+ import { MdClose , MdSearch } from "react-icons/md" ;
45import courseApi from "~/api/course" ;
56import CourseRegisterConfirmDialog from "./CourseRegisterConfirmDialog" ;
67import TagFilter from "./TagFilter" ;
@@ -93,7 +94,7 @@ export default function SelectCourseDialog({
9394 return (
9495 // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
9596 < div
96- className = { `modal ${ open ? "modal-open" : "" } ` }
97+ className = { `modal text-start ${ open ? "modal-open" : "" } ` }
9798 onClick = { ( e ) => e . stopPropagation ( ) }
9899 >
99100 < form className = "modal-backdrop" >
@@ -110,29 +111,31 @@ export default function SelectCourseDialog({
110111 </ form >
111112
112113 < div className = "modal-box" >
113- < h2 className = "font-bold text-lg" >
114- { currentEdit
115- ? `${ DAY_TO_JAPANESE_MAP . get ( currentEdit . columnName ) } 曜${
116- currentEdit . rowIndex + 1
117- } 限の授業を選択`
118- : "授業を選択" }
119- </ h2 >
120- < button
121- type = "button"
122- className = "btn btn-ghost btn-sm absolute top-3 right-3"
123- onClick = { ( ) => {
124- setSearchText ( "" ) ;
125- setFilteredAvailableCourses ( availableCourses ) ;
126- onClose ( ) ;
127- } }
128- >
129- 閉じる
130- </ button >
114+ < div className = "flex items-center justify-between" >
115+ < h2 className = "text-lg" >
116+ { currentEdit
117+ ? `${ DAY_TO_JAPANESE_MAP . get ( currentEdit . columnName ) } 曜${
118+ currentEdit . rowIndex + 1
119+ } 限の授業を編集中`
120+ : "編集" }
121+ </ h2 >
122+ < button
123+ type = "button"
124+ className = "btn btn-circle btn-sm"
125+ onClick = { ( ) => {
126+ setSearchText ( "" ) ;
127+ setFilteredAvailableCourses ( availableCourses ) ;
128+ onClose ( ) ;
129+ } }
130+ >
131+ < MdClose className = "text-2xl" />
132+ </ button >
133+ </ div >
131134 < div className = "my-4" >
132135 < div >
133- < h3 className = "font-semibold text-sm" > 現在の授業</ h3 >
136+ < h3 className = "text-gray-600 text-sm" > 現在の授業</ h3 >
134137 { currentEdit ?. course ? (
135- < div className = "flex items-center justify-between rounded-lg border p-2 " >
138+ < div className = "my-2 flex items-center justify-between rounded-lg" >
136139 < div >
137140 < p className = "text-base" >
138141 { currentEdit ?. course ?. name ?? "-" }
@@ -143,7 +146,7 @@ export default function SelectCourseDialog({
143146 </ div >
144147 < button
145148 type = "button"
146- className = "btn btn-sm"
149+ className = "btn btn-sm font-normal "
147150 onClick = { async ( ) => {
148151 if ( ! currentEdit ?. course ?. id ) return ;
149152 setNewCourse ( currentEdit . course ) ;
@@ -157,20 +160,23 @@ export default function SelectCourseDialog({
157160 < p className = "text-gray-500" > 未登録</ p >
158161 ) }
159162 </ div >
160- < input
161- type = "text"
162- placeholder = "授業名で検索"
163- className = "input input-bordered mt-4 w-full"
164- value = { searchText }
165- onChange = { ( e ) => {
166- const text = e . target . value . trim ( ) ;
167- setSearchText ( text ) ;
168- const newFilteredCourses = availableCourses . filter ( ( course ) =>
169- course . name . includes ( text ) ,
170- ) ;
171- setFilteredAvailableCourses ( newFilteredCourses ) ;
172- } }
173- />
163+ < label className = "input input-bordered mt-4 flex w-full items-center gap-2" >
164+ < MdSearch className = "text-gray-500 text-xl" />
165+ < input
166+ type = "text"
167+ className = "grow"
168+ placeholder = "授業名で検索"
169+ value = { searchText }
170+ onChange = { ( e ) => {
171+ const text = e . target . value . trim ( ) ;
172+ setSearchText ( text ) ;
173+ const newFilteredCourses = availableCourses . filter ( ( course ) =>
174+ course . name . includes ( text ) ,
175+ ) ;
176+ setFilteredAvailableCourses ( newFilteredCourses ) ;
177+ } }
178+ />
179+ </ label >
174180 < div className = "my-4 flex flex-row" >
175181 < TagFilter
176182 keyNameMap = { facultyNameMap }
@@ -194,7 +200,7 @@ export default function SelectCourseDialog({
194200 < li key = { course . id } >
195201 < button
196202 type = "button"
197- className = "w-full cursor-pointer rounded-lg border p-2 hover:bg-gray-100"
203+ className = "w-full cursor-pointer border-b p-2 text-start hover:bg-gray-100"
198204 onClick = { ( ) => {
199205 setNewCourse ( course ) ;
200206 setConfirmDialogStatus ( "add" ) ;
0 commit comments