import { XMarkIcon } from "@heroicons/react/24/outline"

const BottomPopup = ({ children, active, title, close }) => (
  <>
    <div 
      onClick={close} 
      className={`overlay ${active ? 'block' : 'hidden'}`} 
    />
    <div className={`fixed left-0 w-full border-t border-gray_r-6 rounded-t-xl z-[60] p-4 pt-0 bg-white idt-transition ${active ? 'bottom-0' : '-bottom-full'}`}>
      <div className="flex justify-between py-4">
        <div className="font-semibold text-h-sm">{ title }</div>
        <button type="button" onClick={close}>
          <XMarkIcon className="w-5 stroke-2" />
        </button>
      </div>
      { children }
    </div>
  </>
)

export default BottomPopup