Skip to content

Commit 8cb617e

Browse files
ayushnauAyushNautiyalDeveloperbenjagm
authored
Feat: Add the Newsletter feature to the website. (#489)
* initialize the Test directory. * Added the subscribe button. * Added the subscribe page. * Added the newsletter page. * changed name to newsletter. * removed the unwated code. * removed the unwated components. * decreased the horizontal width and changed the color. * decreased the font size. * Added the changes for the newsletter banner. * Added the newletter component to landing page. * added the color for input. * Added the required horizontal padding. * Added the required horizontal padding. for newsletter page. * Add changes to make it work with mailchimp * added the yarn file back. * Added yarn.lock file. * Update yarn.lock * linted the newsletter.tsx * linted newsletter * fix the index.page * Small improvement in page layout. * Fix dark theme behavior * . --------- Co-authored-by: AyushNautiyalDeveloper <[email protected]> Co-authored-by: Benjamin Granados <[email protected]>
1 parent 023a3c0 commit 8cb617e

File tree

3 files changed

+118
-1
lines changed

3 files changed

+118
-1
lines changed

components/Newsletter.tsx

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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&amp;id=11103c248b&amp;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;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@
7373
"tailwindcss": "^3.3.5",
7474
"typescript": "5.2.2"
7575
}
76-
}
76+
}

pages/newsletter/index.page.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import Head from 'next/head';
3+
import { getLayout } from '~/components/SiteLayout';
4+
import NewsletterForm from '~/components/Newsletter';
5+
import { SectionContext } from '~/context';
6+
7+
export default function StaticMarkdownPage() {
8+
const newTitle = 'JSON Schema Newsletter';
9+
return (
10+
<SectionContext.Provider value={null}>
11+
<Head>
12+
<title>{newTitle}</title>
13+
</Head>
14+
<div className='flex flex-col items-center justify-center'>
15+
<div className='max-w-[1400px] mx-auto'>
16+
<NewsletterForm
17+
className='pt-[100px] text-black'
18+
wrapperClassName='h-full sm:h-[calc(100vh-312px)] py-[50px] sm:py-0 px-5 sm:px-10 lg:w-full'
19+
/>
20+
</div>
21+
</div>
22+
</SectionContext.Provider>
23+
);
24+
}
25+
StaticMarkdownPage.getLayout = getLayout;

0 commit comments

Comments
 (0)