@@ -33,18 +33,18 @@ const MapComponent = dynamic(
3333 }
3434) ;
3535
36- interface CountryData {
36+ type CountryData = {
3737 country : string ;
3838 country_code ?: string ;
3939 visitors : number ;
4040 pageviews : number ;
41- }
41+ } ;
4242
43- interface CountryRowProps {
43+ type CountryRowProps = {
4444 country : CountryData ;
4545 totalVisitors : number ;
4646 onCountrySelect : ( countryCode : string ) => void ;
47- }
47+ } ;
4848
4949function CountryRow ( {
5050 country,
@@ -66,7 +66,7 @@ function CountryRow({
6666
6767 return (
6868 < button
69- className = "flex w-full items-center gap-2.5 rounded px-2.5 py-2 text-left transition-colors hover:bg-accent"
69+ className = "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left transition-colors hover:bg-accent sm:gap-2.5 sm:px-2.5 sm:py-2 "
7070 onClick = { ( ) =>
7171 onCountrySelect (
7272 country . country_code ?. toUpperCase ( ) || country . country . toUpperCase ( )
@@ -80,10 +80,11 @@ function CountryRow({
8080 type = "button"
8181 >
8282 < CountryFlag
83+ className = "sm:size-4"
8384 country = {
8485 country . country_code ?. toUpperCase ( ) || country . country . toUpperCase ( )
8586 }
86- size = { 16 }
87+ size = { 14 }
8788 />
8889 < div className = "min-w-0 flex-1" >
8990 < p className = "truncate font-medium text-xs" > { country . country } </ p >
@@ -171,30 +172,33 @@ function WebsiteMapPage() {
171172 selectedCountry = { selectedCountry }
172173 />
173174
174- < div className = "absolute top-3 right-3 z-20" >
175- < Card className = "w-60 gap-0 border bg-card/95 py-0 shadow-lg backdrop-blur-sm" >
176- < CardHeader className = "border-b bg-accent px-3 py-2.5" >
177- < CardTitle className = "flex items-center gap-2 font-semibold text-sm" >
178- < GlobeIcon className = "size-4 text-primary" weight = "duotone" />
175+ < div className = "absolute right-3 bottom-3 left-3 z-20 sm:top-3 sm:right-3 sm:bottom-auto sm:left-auto sm:w-60" >
176+ < Card className = "w-full gap-0 border bg-card/95 py-0 shadow-lg backdrop-blur-sm" >
177+ < CardHeader className = "border-b bg-accent px-2.5 py-2 sm:px-3 sm:py-2.5" >
178+ < CardTitle className = "flex items-center gap-2 font-semibold text-xs sm:text-sm" >
179+ < GlobeIcon
180+ className = "size-3.5 text-primary sm:size-4"
181+ weight = "duotone"
182+ />
179183 Top Countries
180184 </ CardTitle >
181185 </ CardHeader >
182186 < CardContent className = "p-0" >
183187 { isLoading ? (
184- < div className = "space-y-1 p-3" >
188+ < div className = "space-y-1 p-2 sm:p- 3" >
185189 { Array . from ( { length : 5 } ) . map ( ( _ , i ) => (
186190 < div
187- className = "flex items-center gap-2.5 py-1.5"
191+ className = "flex items-center gap-2 py-1 sm:gap-2 .5 sm: py-1.5"
188192 key = { `country-skeleton-${ i + 1 } ` }
189193 >
190- < Skeleton className = "size-4 rounded" />
194+ < Skeleton className = "size-3.5 rounded sm:size-4 " />
191195 < Skeleton className = "h-3 flex-1" />
192196 < Skeleton className = "h-3 w-8" />
193197 </ div >
194198 ) ) }
195199 </ div >
196200 ) : topCountries . length > 0 ? (
197- < div className = "space-y-0.5 p-1.5" >
201+ < div className = "max-h-[40vh] space-y-0.5 overflow-y-auto p-1 sm:max-h-none sm: p-1.5" >
198202 { topCountries . map ( ( country ) => (
199203 < CountryRow
200204 country = { country }
@@ -205,9 +209,9 @@ function WebsiteMapPage() {
205209 ) ) }
206210 </ div >
207211 ) : (
208- < div className = "flex flex-col items-center justify-center p-6 text-center" >
212+ < div className = "flex flex-col items-center justify-center p-4 text-center sm:p-6 " >
209213 < GlobeIcon
210- className = "size-8 text-muted-foreground/30"
214+ className = "size-6 text-muted-foreground/30 sm:size-8 "
211215 weight = "duotone"
212216 />
213217 < p className = "mt-2 text-muted-foreground text-xs" >
@@ -217,9 +221,9 @@ function WebsiteMapPage() {
217221 ) }
218222
219223 { topCountries . length > 0 && (
220- < div className = "flex items-center justify-between border-t bg-accent px-3 py-2" >
224+ < div className = "flex items-center justify-between border-t bg-accent px-2.5 py-1.5 sm:px-3 sm: py-2" >
221225 < span className = "text-muted-foreground text-xs" > Total</ span >
222- < span className = "font-semibold text-sm tabular-nums" >
226+ < span className = "font-semibold text-xs tabular-nums sm:text-sm " >
223227 { totalVisitors . toLocaleString ( ) }
224228 </ span >
225229 </ div >
0 commit comments