import React from 'react' import Header from '../../../components/Header/Header' import Input from '../../../components/Input/Input' import { Country, State, City } from 'country-state-city' import Select from 'react-select' import styles from './Address.module.css' import { useTranslation } from 'react-i18next' const Address = ({ formData, setFormData }) => { const { t } = useTranslation() const countries = Country.getAllCountries() const updatedCountries = countries.map((country) => ({ label: country.name, value: country.id, ...country })) const updatedStates = (countryId) => State.getStatesOfCountry(countryId).map((state) => ({ label: state.name, value: state.id, ...state })) const updatedCities = (countryID, stateId) => City.getCitiesOfState(countryID, stateId).map((city) => ({ label: city.name, value: city.id, ...city })) const customStyles = { control: (base, state) => ({ ...base, width: '330px', height: '60px', margin: '10px 0px', border: '3px solid', borderRadius: '10px !important' }), input: (base, state) => ({ ...base, display: 'flex', justifyContent: 'center', alignItems: 'center', padding: '0px', margin: '0px' }) } return ( <>
{ setFormData({ ...formData, state: e }) }} styles={customStyles} />
{ setFormData({ ...formData, village: e.target.value }) }} placeholder={t('ENTER_YOUR_VILLAGE_TOWN')} />
{ setFormData({ ...formData, houseNo: e.target.value }) }} placeholder={t('ENTER_YOUR_HOUSE_NUMBER_APARTMENT')} /> { setFormData({ ...formData, street: e.target.value }) }} placeholder={t('ENTER_YOUR_STREET_ROAD')} /> { setFormData({ ...formData, locality: e.target.value }) }} placeholder={t('ENTER_YOUR_AREA_LOCALITY')} /> { setFormData({ ...formData, postOffice: e.target.value }) }} placeholder={t('ENTER_YOUR_AREA_POST_OFFICE')} />
{ setFormData({ ...formData, landmark: e.target.value }) }} placeholder={t('ENTER_ANY_NEAREST_LANDMARK')} /> { setFormData({ ...formData, pincode: e.target.value }) }} placeholder={t('ENTER_YOUR_AREA_PINCODE')} />
) } export default Address