🔨 refactor: collapse checkout

:%s
This commit is contained in:
unknown
2021-09-08 09:25:46 +07:00
parent b4c5e9e9a9
commit 4f96426651
259 changed files with 1939 additions and 5672 deletions

View File

@@ -2,29 +2,30 @@ import Link from 'next/link'
import React, { useRef } from 'react'
import { ButtonCommon, Inputcommon } from 'src/components/common'
import InputCommon from 'src/components/common/InputCommon/InputCommon'
import { CheckOutForm } from 'src/utils/types.utils'
import s from './CustomerInfoForm.module.scss'
interface CustomerInfoFormProps {
onConfirm?: ()=>void
onConfirm?: (id: number, formInfo: CheckOutForm) => void
id: number
}
const CustomerInfoForm = ({}: CustomerInfoFormProps) => {
const nameRef = useRef<React.ElementRef<typeof InputCommon>>(null);
const emailRef = useRef<React.ElementRef<typeof InputCommon>>(null);
const CustomerInfoForm = ({ id, onConfirm }: CustomerInfoFormProps) => {
const nameRef = useRef<React.ElementRef<typeof InputCommon>>(null)
const emailRef = useRef<React.ElementRef<typeof InputCommon>>(null)
const handleConfirmClick = () => {
return {
name:nameRef?.current?.getValue(),
email:emailRef.current?.getValue()
}
}
const handleConfirmClick = () => {
onConfirm &&
onConfirm(id, {
name: nameRef?.current?.getValue().toString(),
email: emailRef.current?.getValue().toString(),
})
}
return (
<div className={s.warpper}>
<div className={s.body}>
<Inputcommon type="text" placeholder="Full Name" ref={nameRef}/>
<Inputcommon type="text" placeholder="Email Address" ref={emailRef}/>
<Inputcommon type="text" placeholder="Full Name" ref={nameRef} />
<Inputcommon type="text" placeholder="Email Address" ref={emailRef} />
</div>
<div className={s.bottom}>
<div className={s.note}>
@@ -42,7 +43,9 @@ const CustomerInfoForm = ({}: CustomerInfoFormProps) => {
}
.
</div>
<ButtonCommon onClick={handleConfirmClick}>Continue to Shipping</ButtonCommon>
<ButtonCommon onClick={handleConfirmClick}>
Continue to Shipping
</ButtonCommon>
</div>
</div>
)