Fix phone input and link input (#2679)
* wip * phone picker is appearing * fixing picker placement * set phone picker width * fix link input
This commit is contained in:
@ -140,7 +140,8 @@ export const CountryPickerDropdownButton = ({
|
||||
onChange={handleChange}
|
||||
/>
|
||||
}
|
||||
dropdownOffset={{ x: -60, y: -34 }}
|
||||
dropdownPlacement="bottom-start"
|
||||
dropdownOffset={{ x: 0, y: 4 }}
|
||||
/>
|
||||
</DropdownScope>
|
||||
);
|
||||
|
||||
@ -27,13 +27,6 @@ const StyledIconContainer = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledDropdownMenuContainer = styled.ul`
|
||||
left: 6px;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 26px;
|
||||
`;
|
||||
|
||||
export const CountryPickerDropdownSelect = ({
|
||||
countries,
|
||||
selectedCountry,
|
||||
@ -56,54 +49,50 @@ export const CountryPickerDropdownSelect = ({
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<StyledDropdownMenuContainer data-select-disable>
|
||||
<DropdownMenu width="240px" disableBlur>
|
||||
<DropdownMenuSearchInput
|
||||
value={searchFilter}
|
||||
onChange={(event) => setSearchFilter(event.currentTarget.value)}
|
||||
autoFocus
|
||||
/>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItemsContainer hasMaxHeight>
|
||||
{filteredCountries?.length === 0 ? (
|
||||
<MenuItem text="No result" />
|
||||
) : (
|
||||
<>
|
||||
{selectedCountry && (
|
||||
<DropdownMenu width="200px" disableBlur>
|
||||
<DropdownMenuSearchInput
|
||||
value={searchFilter}
|
||||
onChange={(event) => setSearchFilter(event.currentTarget.value)}
|
||||
autoFocus
|
||||
/>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItemsContainer hasMaxHeight>
|
||||
{filteredCountries?.length === 0 ? (
|
||||
<MenuItem text="No result" />
|
||||
) : (
|
||||
<>
|
||||
{selectedCountry && (
|
||||
<MenuItemSelectAvatar
|
||||
key={selectedCountry.countryCode}
|
||||
selected={true}
|
||||
onClick={() => onChange(selectedCountry.countryCode)}
|
||||
text={`${selectedCountry.countryName} (+${selectedCountry.callingCode})`}
|
||||
avatar={
|
||||
<StyledIconContainer>
|
||||
<selectedCountry.Flag />
|
||||
</StyledIconContainer>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{filteredCountries.map(
|
||||
({ countryCode, countryName, callingCode, Flag }) =>
|
||||
selectedCountry?.countryCode === countryCode ? null : (
|
||||
<MenuItemSelectAvatar
|
||||
key={selectedCountry.countryCode}
|
||||
selected={true}
|
||||
onClick={() => onChange(selectedCountry.countryCode)}
|
||||
text={`${selectedCountry.countryName} (+${selectedCountry.callingCode})`}
|
||||
key={countryCode}
|
||||
selected={selectedCountry?.countryCode === countryCode}
|
||||
onClick={() => onChange(countryCode)}
|
||||
text={`${countryName} (+${callingCode})`}
|
||||
avatar={
|
||||
<StyledIconContainer>
|
||||
<selectedCountry.Flag />
|
||||
<Flag />
|
||||
</StyledIconContainer>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{filteredCountries.map(
|
||||
({ countryCode, countryName, callingCode, Flag }) =>
|
||||
selectedCountry?.countryCode === countryCode ? null : (
|
||||
<MenuItemSelectAvatar
|
||||
key={countryCode}
|
||||
selected={selectedCountry?.countryCode === countryCode}
|
||||
onClick={() => onChange(countryCode)}
|
||||
text={`${countryName} (+${callingCode})`}
|
||||
avatar={
|
||||
<StyledIconContainer>
|
||||
<Flag />
|
||||
</StyledIconContainer>
|
||||
}
|
||||
/>
|
||||
),
|
||||
)}
|
||||
</>
|
||||
),
|
||||
)}
|
||||
</DropdownMenuItemsContainer>
|
||||
</DropdownMenu>
|
||||
</StyledDropdownMenuContainer>
|
||||
</>
|
||||
</>
|
||||
)}
|
||||
</DropdownMenuItemsContainer>
|
||||
</DropdownMenu>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user