import React from 'react' import Header from '../../../components/Header/Header' import { Country, State, City } from 'country-state-city' import Select from 'react-select' import styles from './Address.module.css' import UpdateInput from '../../../components/UpdateInput/UpdateInput' import EditButton from '../../../components/EditButton/EditButton' const Address = ({ formData, setFormData }) => { 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', // padding: '20px 10px', border: '3px solid', borderRadius: '10px !important' }), input: (base, state) => ({ ...base, display: 'flex', justifyContent: 'center', alignItems: 'center', padding: '0px', margin: '0px' }) } const [editable, setEditable] = React.useState(true) const [editable1, setEditable1] = React.useState(true) const [editable2, setEditable2] = React.useState(true) const handleEdit = () => { setEditable(!editable) } const handleEdit1 = () => { setEditable1(!editable1) } const handleEdit2 = () => { setEditable2(!editable2) } console.log(formData.country, formData.state, formData.district, formData.village) return ( <>
{ setFormData({ ...formData, state: e }) }} styles={customStyles} />