fix: gap in menu of country code selector

This commit is contained in:
Koosha Lahouti
2025-09-25 18:00:48 +03:30
parent 4884a5942f
commit 0cd199531e
7 changed files with 16 additions and 20 deletions

2
.npmrc
View File

@@ -1,2 +0,0 @@
@rkheftan:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=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

View File

@@ -163,7 +163,7 @@ export function CountryCodeSelector({
/> />
</Box> </Box>
<Box sx={{ width: '100%', height: '16rem' }}> <Box sx={{ width: '100%', height: '25rem' }}>
{filteredCountries.length === 0 ? ( {filteredCountries.length === 0 ? (
<MenuItem disabled> <MenuItem disabled>
<ListItem> <ListItem>
@@ -176,35 +176,33 @@ export function CountryCodeSelector({
<Virtuoso <Virtuoso
style={{ height: '100%', width: '100%' }} style={{ height: '100%', width: '100%' }}
data={filteredCountries} data={filteredCountries}
initialTopMostItemIndex={searchTerm ? 0 : initialIndex} initialTopMostItemIndex={initialIndex}
itemContent={(_, country) => ( itemContent={(_, country) => (
<MenuItem <MenuItem
key={country.code} key={country.code}
selected={country.phone === value} selected={country.phone === value}
onClick={() => handleSelect(country)} onClick={() => handleSelect(country)}
sx={{ sx={{ justifyContent: 'space-between' }}
minHeight: '48px',
'&.Mui-selected': {
backgroundColor: 'action.selected',
},
}}
> >
<ListItemIcon> <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
<ReactCountryFlag <ListItemIcon sx={{ minWidth: 'auto' }}>
countryCode={country.code} <ReactCountryFlag
svg countryCode={country.code}
style={{ height: '1.125rem', width: '1.125rem' }} svg
style={{ height: '1.125rem', width: '1.125rem' }}
/>
</ListItemIcon>
<ListItemText
primary={t(country.label, { ns: 'country' })}
/> />
</ListItemIcon> </Box>
<ListItemText
primary={t(country.label, { ns: 'country' })}
/>
<Typography color="text.secondary"> <Typography color="text.secondary">
<LTRBox>{country.phone}</LTRBox> <LTRBox>{country.phone}</LTRBox>
</Typography> </Typography>
</MenuItem> </MenuItem>
)} )}
computeItemKey={(_, country) => country.code} computeItemKey={(_, c) => c.code}
/> />
)} )}
</Box> </Box>