@@ -80,29 +80,30 @@ export const HabitList = () => {
8080 return (
8181 < div
8282 key = { habit . id }
83- className = "flex gap-3 p-3 hover:bg-gray-50 dark:hover:bg-gray-900 rounded-md transition-colors group justify-between items-center "
83+ className = "flex gap-2 p-3 hover:bg-gray-50 dark:hover:bg-gray-900 rounded-md transition-colors group items-end md: items-start flex-col md:flex-row "
8484 >
85- < input
86- id = { `habit-checkbox- ${ habit . id } ` }
87- type = " checkbox"
88- checked = { isCompleted }
89- onChange = { ( ) => toggleCompletion ( habit . id , dateStr ) }
90- className = "h-5 w-5 rounded border-gray-300 dark:border-gray-700 text-blue-600 focus:ring-2 focus:ring-blue-500 cursor-pointer"
91- />
92- < label htmlFor = { `habit-checkbox- ${ habit . id } ` } className = "flex-1 cursor-pointer" >
93- < div className = "flex-1" >
85+ < div className = "flex items-start sm:items-center flex-1 gap-3 w-full" >
86+ < input
87+ id = { `habit- checkbox- ${ habit . id } ` }
88+ type = "checkbox"
89+ checked = { isCompleted }
90+ onChange = { ( ) => toggleCompletion ( habit . id , dateStr ) }
91+ className = "h-5 w-5 mt-0.5 sm:mt-0 sm:flex-col flex-shrink-0 rounded border-gray-300 dark:border-gray-700 text-blue-600 focus:ring-2 focus:ring-blue-500 cursor-pointer"
92+ / >
93+ < label htmlFor = { `habit-checkbox- ${ habit . id } ` } className = "flex-1 cursor-pointer min-w-0 " >
9494 < div className = "font-medium text-gray-900 dark:text-gray-100" > { habit . name } </ div >
9595 { habit . description && (
9696 < div className = "text-sm text-gray-600 dark:text-gray-400" > { habit . description } </ div >
9797 ) }
98- </ div >
99- </ label >
100- < div className = "flex gap-2 " >
98+ </ label >
99+ </ div >
100+ < div className = "flex gap-1.5 flex-shrink-0 " >
101101 < button
102102 onClick = { ( ) => {
103103 setAddForm ( { visible : true , id : habit . id , name : habit . name , description : habit . description || '' } ) ;
104104 } }
105- className = "opacity-0 group-hover:opacity-100 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-opacity"
105+ className = "opacity-100 sm:opacity-0 sm:group-hover:opacity-100 px-2 py-1 text-xs sm:text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-all"
106+ aria-label = "Edit habit"
106107 >
107108 Edit
108109 </ button >
@@ -112,7 +113,8 @@ export const HabitList = () => {
112113 deleteHabit ( habit . id ) ;
113114 }
114115 } }
115- className = "opacity-0 group-hover:opacity-100 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-opacity"
116+ className = "opacity-100 sm:opacity-0 sm:group-hover:opacity-100 px-2 py-1 text-xs sm:text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-all"
117+ aria-label = "Delete habit"
116118 >
117119 Delete
118120 </ button >
0 commit comments