|
| 1 | +import React, { useState } from 'react'; |
| 2 | +import classnames from 'classnames'; |
| 3 | + |
| 4 | +interface NewsletterFormProps { |
| 5 | + wrapperClassName?: string; |
| 6 | + className?: string; |
| 7 | + background?: 'white' | 'black'; |
| 8 | +} |
| 9 | + |
| 10 | +const NewsletterForm: React.FC<NewsletterFormProps> = ({ |
| 11 | + wrapperClassName = '', |
| 12 | + className = '', |
| 13 | + background = 'white', |
| 14 | +}) => { |
| 15 | + const [email, setEmail] = useState(''); |
| 16 | + const [username, setUsername] = useState(''); |
| 17 | + const formAction = |
| 18 | + 'https://json-schema.us8.list-manage.com/subscribe/post?u=ef8789d5789a6aff8113a701d&id=11103c248b&f_id=00822be0f0'; |
| 19 | + |
| 20 | + return ( |
| 21 | + <section |
| 22 | + className={classnames( |
| 23 | + 'w-[100vw] mx-auto flex items-center justify-center ', |
| 24 | + background === 'white' |
| 25 | + ? 'bg-white dark:bg-transparent text-black' |
| 26 | + : 'bg-transparent text-white', |
| 27 | + wrapperClassName, |
| 28 | + )} |
| 29 | + > |
| 30 | + <div |
| 31 | + className={classnames( |
| 32 | + 'w-full max-w-[900px] text-center px-5 py-9 relative', |
| 33 | + background === 'white' |
| 34 | + ? 'bg-white dark:bg-transparent' |
| 35 | + : 'bg-transparent', |
| 36 | + className, |
| 37 | + )} |
| 38 | + > |
| 39 | + <h3 className=' font-bold tracking-heading mb-4 text-h4 md:text-h3 px-5 dark:text-slate-50'> |
| 40 | + Subscribe to our newsletter to receive news about Json Schema. |
| 41 | + </h3> |
| 42 | + <p className='text-lg mb-8 dark:text-slate-50'> |
| 43 | + We respect your inbox. No spam, promise ✌️ |
| 44 | + </p> |
| 45 | + <form |
| 46 | + action={formAction} |
| 47 | + method='post' |
| 48 | + className='flex flex-col md:flex-row gap-4' |
| 49 | + > |
| 50 | + <input |
| 51 | + type='text' |
| 52 | + name='FNAME' |
| 53 | + placeholder='Your Name' |
| 54 | + className={classnames( |
| 55 | + 'form-input block w-full py-3 text-lg h-[38px] sm:h-[45px] sm:text-lg sm:leading-5 border-2 md:flex-1 rounded px-5 bg-gray-200 text-black', |
| 56 | + background == 'black' ? 'bg-white' : '', |
| 57 | + )} |
| 58 | + value={username} |
| 59 | + onChange={(e: any) => setUsername(e.target.value)} |
| 60 | + /> |
| 61 | + <input |
| 62 | + type='email' |
| 63 | + name='EMAIL' |
| 64 | + placeholder='Your Email' |
| 65 | + className={classnames( |
| 66 | + 'form-input block w-full py-3 text-lg sm:text-lg border-2 sm:leading-5 h-[38px] sm:h-[45px] md:flex-1 rounded px-5 bg-gray-200 text-black', |
| 67 | + background == 'black' ? 'bg-white' : '', |
| 68 | + )} |
| 69 | + value={email} |
| 70 | + onChange={(e: any) => setEmail(e.target.value)} |
| 71 | + /> |
| 72 | + <button |
| 73 | + type='submit' |
| 74 | + className=' h-[40px] sm:h-[45px] mx-auto rounded border-2 bg-primary w-full font-semibold md:mt-0 md:flex-1 text-white' |
| 75 | + // className='bg-primary-500 hover:bg-primary-400 text-white bg-[#445cf4] transition-all duration-500 ease-in-out rounded-md px-4 py-3 text-md font-semibold tracking-heading w-full md:mt-0 md:flex-1' |
| 76 | + > |
| 77 | + <span className='inline-block'>Subscribe</span> |
| 78 | + </button> |
| 79 | + <div className='display: hidden'> |
| 80 | + <input |
| 81 | + type='text' |
| 82 | + name='b_ef8789d5789a6aff8113a701d_11103c248b' |
| 83 | + value='' |
| 84 | + /> |
| 85 | + </div> |
| 86 | + </form> |
| 87 | + </div> |
| 88 | + </section> |
| 89 | + ); |
| 90 | +}; |
| 91 | + |
| 92 | +export default NewsletterForm; |
0 commit comments