import { motion } from 'framer-motion';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { BottomSheetMotionDuration, BottomSheetMotionVaiants } from '@/entities/common/model/constant';

export interface CreditCardListBottomSheetProps {
  creditCardListBottomSheetOn: boolean;
  setCreditCardListBottomSheetOn: (creditCardListBottomSheetOn: boolean) => void;
};

export const CreditCardListBottomSheet = ({
  creditCardListBottomSheetOn,
  setCreditCardListBottomSheetOn
}: CreditCardListBottomSheetProps) => {

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

  return (
    <>
      { creditCardListBottomSheetOn &&
      <div className="bg-dim"></div>
      }
      <motion.div 
        className="bottomsheet"
        initial="hidden"
        animate={ (creditCardListBottomSheetOn)? 'visible': 'hidden' }
        variants={ BottomSheetMotionVaiants }
        transition={ BottomSheetMotionDuration }
      >
        <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="card-list">
            <div className="card-option selected">
              <span className="name">KB국민</span>
              <i className="check"></i>
            </div>
            <div className="card-option">
              <span className="name">비씨</span>
              <i className="check"></i>
            </div>
            <div className="card-option">
              <span className="name">하나(외환)</span>
              <i className="check"></i>
            </div>
            <div className="card-option">
              <span className="name">삼성</span>
              <i className="check"></i>
            </div>
            <div className="card-option">
              <span className="name">신한</span>
              <i className="check"></i>
            </div>
            <div className="card-option">
              <span className="name">현대</span>
              <i className="check"></i>
            </div>
            <div className="card-option">
              <span className="name">롯데</span>
              <i className="check"></i>
            </div>
          </div>
        </div>

        <div className="bottomsheet-footer">
          <button 
            className="btn-50 btn-blue flex-1" 
            type="button"
          >확인</button>
        </div>
      </motion.div>
    </>
  );
};