lytrankieio123 3c09ad1770 🎨 styles: home subscribe
:%s
2021-08-26 16:13:11 +07:00

38 lines
1.1 KiB
TypeScript

import React, { useRef } from 'react'
import { ButtonCommon, Inputcommon } from 'src/components/common'
import { CustomInputCommon } from 'src/utils/type.utils';
import s from './FormSubscribe.module.scss'
const FormSubscribe = () => {
const inputElementRef = useRef<CustomInputCommon>(null);
const handleSubmit = (e?: any) => {
// todo
let value: string
if (typeof (e) === 'string') {
value = e
} else {
e.preventDefault && e.preventDefault()
value = inputElementRef.current?.getValue()?.toString() || ''
}
console.log("email here: ", value)
}
return (
<section className={s.formSubscribe}>
<Inputcommon
type='email'
styleType='custom'
placeholder="Enter your email"
ref={inputElementRef}
onEnter={handleSubmit}
backgroundTransparent={true}
/>
<ButtonCommon onClick={handleSubmit} type='lightBorderNone'>Subsribe</ButtonCommon>
</section>
)
}
export default FormSubscribe