Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
RitaVeiga committed May 26, 2022
1 parent 86acca4 commit c3c86d8
Show file tree
Hide file tree
Showing 11 changed files with 319 additions and 60 deletions.
2 changes: 1 addition & 1 deletion components/CardsLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function CardsLayout({ children, description }) {
const { hasItemsOnLeft, hasItemsOnRight, scrollRight, scrollLeft } =
usePosition(ref);
return (
<div className="w-full pb-20 relative overflow-hidden card-layout">
<div className="w-full relative overflow-hidden card-layout">
<h2 className="pb-20 lg:mt-10 text-3xl md:text-4xl z-10 text-center">
{description}
</h2>
Expand Down
2 changes: 1 addition & 1 deletion components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Footer = () => {
<footer
className={`flex flex-col items-center ${
theme === 'dark' ? cardsBackgroundColor : 'bg-neutral'
} text-neutral-content mt-20`}
} text-neutral-content `}
>
<div className="flex flex-col justify-between w-11/12 max-w-screen-xl py-7 px-10 sm:flex-row sm:px-0 mt-10 sm:pt-10 sm:mt-14 sm:border-t border-gray-400">
<div className="hidden px-4 sm:flex ">
Expand Down
95 changes: 95 additions & 0 deletions components/HeroSectionModified.js
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;
9 changes: 4 additions & 5 deletions components/HotMealDaySection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import { CardAction } from './Card';
import { SVGHotMealDaySectionBackground, SVGQuotes } from './SVGBackgrounds';
import Image from 'next/image';
import React from 'react';
Expand All @@ -22,19 +21,19 @@ function HotMealDaySection() {
className={`w-lg p-5 lg:p-5 section-box z-10 ${cardsBackgroundColor}`}
>
<div className="grid sm:grid-cols-1 md:grid-cols-2">
<div className="space-y-3 p-4 py-10 md:p-14 lg:pr-10 md:text-left quote-container relative z-10">
<div className="m-5">
<SVGQuotes className="absolute quotes top-0 left-0" />
<h2 className="text-3xl md:text-5xl md:text-left pb-7 font-bold quote z-10">
{'Hot Meal Day'}
</h2>
<div className="md:pl-5">
<div>
<p className="w-full">
{
'Buy ingredients for 1 hot meal for 60 hungry people. Sample meals include spaghetti with Texas toast and caesar salad, chicken alfredo, enchilada taquitos. Served as take-home meal boxes at Grace Resources in Lancaster, California.'
}
</p>
<hr className="my-5 w-full border-blue" />
<div className="flex1 md:items-end ">
<div className="lg:flex md:items-end ">
<p className="md:col-span-2 lg:pb-0">
{
'Make a donation today and you can help us bring hot meals to the most needy in our society.'
Expand Down Expand Up @@ -88,7 +87,7 @@ function HotMealDaySection() {
hyphens: auto;
white-space: nowrap;
}
.flex1 {
.lg:flex {
display: flex;
flex-direction: column;
}
Expand Down
117 changes: 117 additions & 0 deletions components/MainDonation.js
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>
</>
);
}
11 changes: 3 additions & 8 deletions components/PrimaryLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,18 @@ import PropTypes from 'prop-types';
import React from 'react';

import Footer from './Footer';
import HeroSection from './HeroSection';
import HeroSectionModified from './HeroSectionModified';
import Navbar from './Navbar';
import { useContextTheme } from './ThemeContext';

export default function PrimaryLayout({
main = false,
image,
inNeed = false,
children,
}) {
export default function PrimaryLayout({ main = false, image, children }) {
const { backgroundColor, textColor } = useContextTheme();
return (
<>
<div className={`flex flex-col min-h-screen ${backgroundColor}`}>
<Navbar />
<main className={`flex-grow ${backgroundColor} text-${textColor}`}>
<HeroSection image={image} inNeed={inNeed} main={main} />
<HeroSectionModified image={image} main={main} />
{children}
</main>
<Footer />
Expand Down
Loading

0 comments on commit c3c86d8

Please sign in to comment.