import { BottomSheetMotionDuration, BottomSheetMotionVaiants } from "@/entities/common/model/constant";
import { IMAGE_ROOT } from '@/shared/constants/common';
import { motion } from 'framer-motion';
export interface ArsResendSmsBottomSheetProps {
  bottomSheetOn: boolean;
  setBottomSheetOn: (bottomSheetOn: boolean) => void;
  phoneNumber?: string;
  callResendSms: () => void;
};

export const ArsResendSmsBottomSheet = ({
  bottomSheetOn,
  setBottomSheetOn,
  phoneNumber,
  callResendSms
}: ArsResendSmsBottomSheetProps) => {

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

  const onCliickToResendSms = () => {
    if(callResendSms){
      callResendSms();
    }
    onClickToClose();
  };

  return (
    <>
      { (bottomSheetOn) &&
        <div className="bg-dim"></div>
      }
      <motion.div 
        className="bottomsheet"
        initial="hidden"
        animate={ (bottomSheetOn)? 'visible': 'hidden' }
        variants={ BottomSheetMotionVaiants }
        transition={ BottomSheetMotionDuration }
      >
        <div className="bottomsheet-header">
          <div className="bottomsheet-title">
            <h2>SMS 재전송</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="bottom-section">
            <p>[01095800212] 번호로 SMS를 재발송 하시겠습니까?</p>
          </div>
        </div>
        <div className="bottomsheet-footer">
          <button
            className="btn-50 btn-blue flex-1"
            type="button"
            onClick={ () => onCliickToResendSms() }
          >신청</button>
        </div>
      </motion.div>
    </>
  );
};