Skip to content

Commit

Permalink
country area phone input editable (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
artweb11 authored Nov 23, 2023
1 parent c7cdec5 commit abb7d7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions components/atoms/Input/Country.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import { CountryContext } from '../Stepper/Forms/identity2';
import Image from 'next/image';

export default function CountrySelect() {
const { setCountry, setCountryLabel } = useContext(CountryContext);
const { setCountry, setCountryLabel, country } = useContext(CountryContext);

return (
<Autocomplete
id="country-select-demo"
className="w-full"
contentEditable={false}
onChange={(e, value) => {
setCountryLabel(value.label);
setCountry(value.code.toLowerCase());
setCountryLabel(value?.label || '');
setCountry(value?.code?.toLowerCase() || '');
}}
options={countries}
autoHighlight
Expand Down
6 changes: 5 additions & 1 deletion components/atoms/Stepper/Forms/identity2.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,18 @@ function Identity2() {
fullWidth
label="Numéro de Téléphone"
variant="outlined"
countryCodeEditable={false}
countryCodeEditable={true}
select={false}
value={localStorage.getItem('phoneNumber') ?? ''}
defaultValue={localStorage.getItem('phoneNumber') ?? ''}
onChange={(value, country) => {
formik.setFieldValue('phoneNumber', value);
formik.setFieldValue('country', country.countryCode);
setDial(country.dialCode);
if( country ){
setCountry( country.countryCode );
setCountryLabel( country.countryLabel );
}
localStorage.setItem('phoneNumber', value);
localStorage.setItem('country', country.countryCode);
}}
Expand Down

1 comment on commit abb7d7b

@vercel
Copy link

@vercel vercel bot commented on abb7d7b Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wii-qare-fe – ./

wii-qare-fe.vercel.app
wii-qare-fe-wiiqare.vercel.app
wii-qare-fe-git-main-wiiqare.vercel.app

Please sign in to comment.