import { IMAGE_ROOT } from '@/shared/constants/common';
import { motion } from 'framer-motion';

export interface EscrowMailResendBottomSheetProps {
  setBottomSheetOn: (bottomSheetOn: boolean) => void;
  bottomSheetOn: boolean;
  callMailResend: () => void;
};

export const EscrowMailResendBottomSheet = ({
  setBottomSheetOn,
  bottomSheetOn,
  callMailResend
}: EscrowMailResendBottomSheetProps) => {

  const onClickToClose = () => {
    setBottomSheetOn(false);
  };
  const onClickToMailResend = () => {
    callMailResend();
  };

  const variants = {
    hidden: { y: '100%' },
    visible: { y: '0%' },
  };

  return (
    <>
      { (bottomSheetOn) &&
        <div className="bg-dim"></div>
      }
      <motion.div 
        className="bottomsheet"
        initial="hidden"
        animate={ (bottomSheetOn)? 'visible': 'hidden' }
        variants={ variants }
        transition={{ duration: 0.5 }}
      >
        <div className="bottomsheet-header">
          <div className="bottomsheet-title">
            <h2>이메일 주소를 선택하세요</h2>
            <button
              className="close-btn"
              type="button"
            >
              <img
                src={ IMAGE_ROOT + '/ico_close.svg' }
                alt="닫기"
                onClick={ () => onClickToClose() }
              />
            </button>
          </div>
        </div>

        <div className="bottomsheet-content">
          <div className="email-section">
            <div className="email-label">
              <div className="mail-icon">
                <div className="mail-icon-bg"></div>
                <img
                  src={ IMAGE_ROOT +'/ico_email.svg' }
                  alt="메일"
                />
              </div>
              <span className="label-text">메일로 받기</span>
            </div>
              
            <div className="email-select">
              <div className="select-wrapper">
                <select>
                  <option>선택</option>
                  <option>선택1</option>
                  <option>선택2</option>
                </select>
              </div>
            </div>
              
            <div className="error-message">
              <p>등록된 메일 정보가 없습니다.<br />이메일 인증정보를 사용자관리 메뉴에서 추가 후 신청하세요.</p>
            </div>
          </div>
        </div>

        <div className="bottomsheet-footer">
          <button
            className="btn-50 btn-blue flex-1"
            type="button"
            onClick={ () => onClickToMailResend() }
          >신청</button>
        </div>
      </motion.div>
    </>
  );
};