import { NominatimReverseGeocodingResponse } from '../../types/Types';
import { formatSelectedAddress } from '../utils/formatAddress';

interface AddressDisplayProps {
    selectedAddress: NominatimReverseGeocodingResponse | null;
}

export const AddressDisplay = ({ selectedAddress }: AddressDisplayProps) => {
    return (
        <div className='px-4 mt-2 bg-container'>
            <span className='text-sm'>
                {!selectedAddress ? (
                    'آدرس را به صورت دستی وارد کنید'
                ) : (
                    formatSelectedAddress(selectedAddress)
                )}
            </span>
            <hr className='border border-border mt-3 mb-10' />
        </div>
    );
};

