import React from 'react';
import { useRegionalizationContext } from '../../context/RegionalizationContext';
import { Close } from '../../assets/Icons/Close';

interface TitleProps {
  title?: string;
}

export const Title = ({ title }: TitleProps) => {
  const { setModalOpen, setView } = useRegionalizationContext();

  return (
    <div className="title-container">
      <h1>{title}</h1>
      <button
        onClick={() => {
          setView?.('PostalCodeInputScreen');
          setModalOpen(false);
        }}
      >
        <Close />
      </button>
    </div>
  );
};
