Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add the Newsletter feature to the website. #308

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d9162a4
initialize the Test directory.
AyushNautiyalDeveloper Feb 12, 2024
acd00e8
Added the subscribe button.
AyushNautiyalDeveloper Feb 13, 2024
d8976e6
Added the subscribe page.
AyushNautiyalDeveloper Feb 13, 2024
2d81616
Added the newsletter page.
AyushNautiyalDeveloper Feb 15, 2024
18406f1
changed name to newsletter.
AyushNautiyalDeveloper Feb 15, 2024
cb8e606
removed the unwated code.
AyushNautiyalDeveloper Feb 15, 2024
95ce601
removed the unwated components.
AyushNautiyalDeveloper Feb 15, 2024
c2428ba
decreased the horizontal width and changed the color.
AyushNautiyalDeveloper Feb 20, 2024
5250509
decreased the font size.
AyushNautiyalDeveloper Feb 20, 2024
27ff58e
Added the changes for the newsletter banner.
AyushNautiyalDeveloper Feb 22, 2024
f313f77
Added the newletter component to landing page.
AyushNautiyalDeveloper Feb 22, 2024
f933741
added the color for input.
AyushNautiyalDeveloper Feb 22, 2024
5854389
Added the required horizontal padding.
AyushNautiyalDeveloper Feb 24, 2024
46c1b31
Added the required horizontal padding. for newsletter page.
AyushNautiyalDeveloper Feb 24, 2024
31dfed6
Add changes to make it work with mailchimp
benjagm Feb 24, 2024
e711443
Merge branch 'main' of github.com:json-schema-org/website
AyushNautiyalDeveloper Mar 5, 2024
be054b4
Merge remote-tracking branch 'origin/main'
AyushNautiyalDeveloper Mar 5, 2024
3661714
added the yarn file back.
AyushNautiyalDeveloper Mar 9, 2024
562b313
Added yarn.lock file.
AyushNautiyalDeveloper Mar 9, 2024
47db7d7
added old package .json file.
AyushNautiyalDeveloper Mar 9, 2024
5796e8a
Update yarn.lock
ayushnau Mar 9, 2024
2c91cc9
linted the newsletter.tsx
AyushNautiyalDeveloper Mar 9, 2024
a363438
linted newsletter
AyushNautiyalDeveloper Mar 9, 2024
c186192
fix the index.page
AyushNautiyalDeveloper Mar 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions components/Newsletter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React, { useState } from 'react'
import classnames from 'classnames'

interface NewsletterFormProps {
wrapperClassName?: string
className?: string
}
const NewsletterForm: React.FC<NewsletterFormProps> = ({ wrapperClassName = '', className = '' }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component is going to be presented in two scenarios:

  1. In the newsletter page with while background and black letters. (default)
  2. In the landing page call to action banners, with blue background and white letters. (see image)

Screenshot 2024-02-21 at 11 45 31

With that in mind you will need to define an input parameter allowing to define what of those 2 behaviours the component will render.

const [email, setEmail] = useState('')
const [username, setUsername] = useState('')

// const handleSubmit = (e: any) => {
// e.preventDefault()
// // Handle form submission here, such as sending a request to subscribe the user
// }

// const handleFileChange = (e: any) => {

// }

return (
<section
benjagm marked this conversation as resolved.
Show resolved Hide resolved
className={classnames('w-[100vw] mx-auto flex items-center justify-center bg-[#090A11]', wrapperClassName)}>
<div className={classnames('w-full max-w-[900px] text-center px-5 py-9 bg-[#090A11] relative', className)}>

<h3 className=' font-bold tracking-heading mb-4 text-h3 px-5'>
Subscribe to our newsletter to receive news about Json Schema.
</h3>
<p
className='text-lg mb-8'
>
We respect your inbox. No spam, promise ✌️
</p>
<form className='flex flex-col md:flex-row gap-4'>
<input
type='text'
name='username'
placeholder='Your Name'
className='form-input block w-full py-3 text-lg sm:text-lg sm:leading-5 md:flex-1 rounded-md px-5 bg-gray-200'
value={username}
onChange={(e: any) => setUsername(e.target.value)}
/>
<input
type='email'
name='email'
placeholder='Your Email'
className='form-input block w-full py-3 text-lg sm:text-lg sm:leading-5 md:flex-1 rounded-md px-5 bg-gray-200'
value={email}
onChange={(e: any) => setEmail(e.target.value)}
/>
<button
benjagm marked this conversation as resolved.
Show resolved Hide resolved
type='submit'
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'
>
<span className='inline-block'>Subscribe</span>
</button>
</form>
</div>

</section>
)
}

export default NewsletterForm
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"export": "next export",
"lint": "eslint . --ext .tsx --ext .ts --max-warnings 0",
"lint-fix": "eslint . --ext .tsx --ext .ts --fix --max-warnings 0",
"ts": "tsc --noEmit"
"ts": "tsc --noEmit",
"test": "jest tests/endtoend/broken_link_tests.ts"
},
"engines": {
"node": "^20.0.0"
Expand Down Expand Up @@ -43,6 +44,7 @@
},
"devDependencies": {
"@next/eslint-plugin-next": "^14.0.1",
"@types/jest": "^29.5.12",
"@types/js-yaml": "^4.0.5",
"@types/node": "^20.0.0",
"@types/react": "18.2.37",
Expand All @@ -60,7 +62,9 @@
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0",
"jest": "^29.7.0",
"postcss": "^8.4.31",
"puppeteer": "^22.0.0",
"tailwindcss": "^3.3.5",
"typescript": "5.2.2"
}
Expand Down
2 changes: 1 addition & 1 deletion pages/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ const Home = (props: any) => {
<section className='w-full h-[300px] lg:h-[367px] bg-gradient-to-r from-primary from-1.95% to-endBlue clip-both'>
<div className='lg:w-full mx-auto text-center mt-28 '>
<h2 className='text-h3mobile lg:text-h3 text-white mb-6'>Start contributing to JSON Schema</h2>
<button className='w-[170px] h-[45px] mx-auto rounded border-2 bg-primary text-white font-semibold'><a href='https://github.com/json-schema-org#-contributing-to-json-schema'>Contribute</a></button>
<button className='w-[170px] h-[45px] mx-auto rounded border-2 bg-primary text-white font-semibold'><a href='/newsletter'>Subscribe</a></button>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wha we need here is to show the component itself, no a button to navigate to the newsletter page. We need here to remove that extra step. Make it is easy for the user to subscribe.

See my first comment regarding how to make the component use different fonts/colours depending on the context.

My expectation is to implement the same approach than asyncapi. They show component in the landing page with white fonts:
https://www.asyncapi.com/en
And they show the component with black fonts in the newsletter page:
https://www.asyncapi.com/newsletter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added.

</div>
</section>

Expand Down
16 changes: 16 additions & 0 deletions pages/newsletter/index.page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import NewsletterForm from '~/components/Newsletter'
import Layout from '~/components/Layout'

const index = () => {
return (
<>
<Layout>
<NewsletterForm className='pt-[100px] bg-white text-black' wrapperClassName='h-[calc(100vh-340px)] bg-white' />
</Layout>

</>
)
}

export default index
Loading