forked from margaritahumanitarian/helpafamily
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
319 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import Image from 'next/image'; | ||
import React from 'react'; | ||
|
||
import MainDonation from './MainDonation'; | ||
|
||
function HeroSectionModified({ main = false, image, inNeed = false }) { | ||
return ( | ||
<div className={`text-center ${!main && 'hero-content'} md:m-auto`}> | ||
{main && ( | ||
<div className="hero-image-container"> | ||
<Image | ||
alt="Background" | ||
className="hero-image" | ||
layout="fill" | ||
objectFit="cover" | ||
src={image} | ||
/> | ||
</div> | ||
)} | ||
<div className={main && 'hero'}> | ||
<div className="w-lg p-5"> | ||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 md:gap-x-8 gap-y-5 items-center"> | ||
{!main && ( | ||
<div className="md:col-span-1"> | ||
<Image | ||
alt="Margarita Humanitarian Foundation" | ||
height={180} | ||
src="/images/MHF-Color-300x300.png" | ||
width={180} | ||
/> | ||
</div> | ||
)} | ||
{main && <div className="bg-image-filter" />} | ||
<div className={`md:col-span-${main ? '2' : 1} p-10 z-10`}> | ||
<h1 | ||
className={`text-3xl ${ | ||
main && 'md:text-5xl text-white ' | ||
} font-extrabold m-4 max-w-lg`} | ||
> | ||
{'Help A Family Today'} | ||
</h1> | ||
<p | ||
className={`md:text-xl m-5 ${ | ||
main && 'text-white text-opacity-90' | ||
} leading-tight max-w-lg`} | ||
> | ||
{ | ||
'Many families are struggling to pay their bills and put food on the table. Help out today in the community.' | ||
} | ||
</p> | ||
</div> | ||
<div | ||
className={`${!main && 'sm:col-span-2 '} md:col-span-1 max-w-md`} | ||
> | ||
<MainDonation inNeed={inNeed} /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<style jsx>{` | ||
.bg-image { | ||
z-index: -10; | ||
} | ||
.bg-image-filter { | ||
position: absolute; | ||
z-index: 0; | ||
top: 80px; | ||
left: 0; | ||
min-height: 85vh; | ||
width: 100%; | ||
background: linear-gradient( | ||
to right bottom, | ||
rgba(54, 38, 9, 0.6), | ||
rgba(20, 81, 116, 0.3) | ||
); | ||
object-fit: cover; | ||
} | ||
.hero { | ||
min-height: 85vh; | ||
} | ||
.hero-image-container { | ||
min-height: 85vh; | ||
width: 100%; | ||
position: absolute; | ||
z-index: 0; | ||
} | ||
.hero-image { | ||
position: relative; | ||
} | ||
`}</style> | ||
</div> | ||
); | ||
} | ||
|
||
export default HeroSectionModified; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
|
||
import InputFormControl from './form/InputFormControl'; | ||
import Modal from './Modal'; | ||
import useStripeSessionWithUserInfo from '../hooks/useStripeSessionWithUserInfo'; | ||
|
||
export default function MainDonation() { | ||
const [modalText, setModalText] = React.useState(''); | ||
const [isModalOpen, setModalOpen] = React.useState(false); | ||
const [amount, setAmount] = React.useState(0); | ||
const [email, setEmail] = React.useState(''); | ||
const [name, setName] = React.useState(''); | ||
const [handleSubmit, isPending] = useStripeSessionWithUserInfo(); | ||
|
||
const hideModal = () => setModalOpen(false); | ||
|
||
const showModal = (message) => { | ||
setModalText(message); | ||
setModalOpen(true); | ||
}; | ||
|
||
const handleSubmitForm = async (event) => { | ||
event.preventDefault(); | ||
|
||
if (!name) { | ||
showModal('Please choose a name'); | ||
return; | ||
} | ||
if (!email) { | ||
showModal('Please choose an email'); | ||
return; | ||
} | ||
if (!amount) { | ||
showModal('Please choose an amount to give'); | ||
return; | ||
} | ||
|
||
await handleSubmit({ name, email, amount }); | ||
}; | ||
|
||
return ( | ||
<> | ||
<form onSubmit={handleSubmitForm}> | ||
<div className="p-6 bcolor mb-5 card bg-base-100 space-y-3 text-black"> | ||
<h2 className="card-title text-color" data-theme="light"> | ||
{'Give Today'} | ||
</h2> | ||
<label className="input-labelText"> {'Name'}</label> | ||
<InputFormControl | ||
className="input-color" | ||
id="name" | ||
onChange={setName} | ||
value={name} | ||
/> | ||
<label className="input-labelText"> {'Email'}</label> | ||
<InputFormControl | ||
className="input-color" | ||
id="email" | ||
onChange={setEmail} | ||
value={email} | ||
/> | ||
|
||
<label className="input-labelText"> {'Amount'}</label> | ||
<InputFormControl | ||
className="input-color" | ||
id="amount" | ||
onChange={setAmount} | ||
value={amount} | ||
/> | ||
<div className="pb-5" /> | ||
<button | ||
aria-label="donate-btn" | ||
type="submit" | ||
className={clsx('btn-accent rounded-none m-5', { | ||
loading: isPending, | ||
})} | ||
> | ||
{'Donate Now'} | ||
</button> | ||
</div> | ||
</form> | ||
<Modal isOpen={isModalOpen} onClose={hideModal}> | ||
{modalText} | ||
</Modal> | ||
|
||
<style jsx>{` | ||
.bcolor { | ||
background: rgba(26, 30, 30, 0.48); | ||
box-shadow: 4px 4px 17px rgba(0, 0, 0, 0.25); | ||
border-radius: 9px; | ||
border-color: rgba(0, 0, 0, 0.25); | ||
} | ||
.text-color { | ||
font-family: 'Roboto'; | ||
font-style: normal; | ||
font-weight: 400; | ||
font-size: 36px; | ||
line-height: 42px; | ||
color: #ffffff; | ||
} | ||
.input-labelText { | ||
text-align: left; | ||
color: #ffffff; | ||
} | ||
.input-color { | ||
background: #f7f7f7; | ||
opacity: 0.7; | ||
border-radius: 2px; | ||
} | ||
`}</style> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.