Refactor code structure for improved readability and maintainability

This commit is contained in:
2025-12-19 11:59:52 -06:00
parent 1d4ed96dc9
commit a6656b1ff0
5 changed files with 1026 additions and 455 deletions

View File

@@ -55,13 +55,13 @@ const Donate = () => {
};
return (
<div className="min-h-screen ]">
<div className="min-h-screen">
<PublicNavbar />
<main className="bg-gradient-to-bl from-[#F9FAFB] to-[#DDD8EB] px-4 sm:px-6 md:px-8 lg:px-12 xl:px-16 py-8 sm:py-10 md:py-12">
{/* Hero Section */}
<section className="py-12">
<div className="max-w-4xl mx-auto text-center">
<div className="max-w-4xl mx-auto text-center h-full">
<div className="flex justify-center mb-4">
<img src={loafHearts} alt="Hearts" className="w-32 h-auto" onError={(e) => e.target.style.display = 'none'} />
</div>
@@ -75,97 +75,111 @@ const Donate = () => {
</div>
</section>
{/* Donation Amount Buttons */}
<section className="py-12">
<div className="max-w-4xl mx-auto">
<Card className="p-8 bg-white rounded-2xl shadow-lg">
<div className="flex items-center gap-4 mb-6">
<CreditCard className="w-12 h-12 text-[#664fa3]" />
<h2 className="text-3xl font-bold text-[#48286e]" style={{ fontFamily: "'Inter', sans-serif" }}>
Select Your Donation Amount
</h2>
</div>
{/* Columns */}
<div className="py-12">
<div className='grid grid-cols-1 items-stretch lg:grid-cols-[2fr_1fr] gap-8 max-h-[450px]'>
{/* Donation Buttons Grid */}
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
{[25, 50, 100, 250].map(amount => (
<Button
key={amount}
onClick={() => handleDonateAmount(amount * 100)}
disabled={processingAmount === amount * 100}
className="bg-[#664fa3] hover:bg-[#48286e] text-white text-xl py-8 rounded-full disabled:opacity-50"
>
{processingAmount === amount * 100 ? (
<Loader2 className="h-6 w-6 animate-spin" />
) : (
`$${amount}`
)}
</Button>
))}
</div>
{/* Custom Amount Button */}
<Button
onClick={() => setCustomAmountDialogOpen(true)}
disabled={processingAmount !== null}
className="w-full bg-[#664fa3] hover:bg-[#48286e] text-white text-xl py-8 rounded-full flex items-center justify-center gap-2"
>
<Heart className="h-6 w-6" />
Donate Any Amount
</Button>
<p className="text-sm text-[#664fa3] text-center mt-4" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
Secure donation processing powered by Stripe
</p>
</Card>
</div>
</section>
{/* Alternative Payment Methods */}
<section className="py-12">
<div className="max-w-6xl mx-auto">
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
{/* Mail Check */}
<Card className="p-8 bg-white rounded-2xl shadow-lg">
<Mail className="w-12 h-12 text-[#664fa3] mb-4" />
<h3 className="text-2xl font-bold text-[#48286e] mb-4" style={{ fontFamily: "'Inter', sans-serif" }}>
Mail a Check
</h3>
<p className="text-lg text-[#48286e] leading-relaxed" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
Our mailing address for checks:<br />
<span className="font-semibold">LOAF</span><br />
P.O. Box 7207<br />
Houston, Texas 77248-7207
</p>
</Card>
{/* Zelle */}
<Card className="p-8 bg-white rounded-2xl shadow-lg">
<div className="mb-4">
<img src={zelleLogo} alt="Zelle" className="h-32" onError={(e) => e.target.style.display = 'none'} />
{/* Donation Amount Buttons */}
<section className="flex flex-col h-full">
<div className="mx-auto flex-1 w-full h-full">
<Card className="p-8 bg-white rounded-3xl w-full h-full content-center">
<div className="flex items-center gap-4 mb-6">
<CreditCard className="size-24 text-[#664fa3]" />
<h2 className="text-3xl font-bold text-[#48286e]" style={{ fontFamily: "'Inter', sans-serif" }}>
Select Your Donation Amount
</h2>
</div>
<h3 className="text-2xl font-bold text-[#48286e] mb-4" style={{ fontFamily: "'Inter', sans-serif" }}>
Pay with Zelle
</h3>
<p className="text-lg text-[#48286e] leading-relaxed mb-2" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
If your bank allows the use of Zelle, please feel free to send money to:
{/* Donation Buttons Grid */}
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
{[25, 50, 100, 250].map(amount => (
<Button
key={amount}
onClick={() => handleDonateAmount(amount * 100)}
disabled={processingAmount === amount * 100}
className="bg-[#664fa3] hover:bg-[#48286e] text-white text-xl py-8 rounded-full disabled:opacity-50"
>
{processingAmount === amount * 100 ? (
<Loader2 className="h-6 w-6 animate-spin" />
) : (
`$${amount}`
)}
</Button>
))}
</div>
{/* Custom Amount Button */}
<Button
onClick={() => setCustomAmountDialogOpen(true)}
disabled={processingAmount !== null}
className="w-full bg-[#664fa3] hover:bg-[#48286e] text-white text-xl py-8 rounded-full flex items-center justify-center gap-2"
>
<Heart className="h-6 w-6" />
Donate Any Amount
</Button>
<p className="text-sm text-[#664fa3] text-center mt-4" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
Secure donation processing powered by Stripe
</p>
<a href="mailto:LOAFHoustonTX@gmail.com"
className="text-[#664fa3] text-lg font-bold underline hover:text-[#48286e] transition-colors"
style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
LOAFHoustonTX@gmail.com
</a>
</Card>
</div>
</section>
{/* Alternative Payment Methods */}
<section className="flex flex-col">
<div className="max-w-6xl mx-auto w-full">
<div className="flex flex-col gap-8 w-full">
{/* Mail Check */}
<Card className="p-8 bg-white rounded-3xl flex gap-4 items-center flex-1">
<Mail className="size-24 text-[#664fa3]" />
<div>
<h3 className="text-2xl font-bold text-[#48286e] mb-4" style={{ fontFamily: "'Inter', sans-serif" }}>
Mail a Check
</h3>
<p className="text-lg text-[#48286e] leading-relaxed" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
Our mailing address for checks:<br />
<span className="font-semibold">LOAF</span><br />
P.O. Box 7207<br />
Houston, Texas 77248-7207
</p>
</div>
</Card>
{/* Zelle */}
<Card className="p-8 bg-white rounded-3xl flex gap-4 items-center flex-1">
<div className="w-44">
<img src={zelleLogo} alt="Zelle" className=" w-32" onError={(e) => e.target.style.display = 'none'} />
</div>
<div>
<h3 className="text-2xl font-bold text-[#48286e] mb-4" style={{ fontFamily: "'Inter', sans-serif" }}>
Pay with Zelle
</h3>
<p className="text-lg text-[#48286e] leading-relaxed mb-2" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
If your bank allows the use of Zelle, please feel free to send money to:
</p>
<a href="mailto:LOAFHoustonTX@gmail.com"
className="text-[#664fa3] text-lg font-bold underline hover:text-[#48286e] transition-colors"
style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
LOAFHoustonTX@gmail.com
</a>
</div>
</Card>
</div>
</div>
</section>
</div>
</section>
</div>
{/* Columns end */}
</main>
<PublicFooter />
{/* Custom Amount Dialog */}
<Dialog open={customAmountDialogOpen} onOpenChange={setCustomAmountDialogOpen}>
<DialogContent className="sm:max-w-[450px] bg-white rounded-2xl">
<DialogContent className="sm:max-w-[450px] bg-white rounded-3xl">
<DialogHeader>
<DialogTitle className="text-2xl font-semibold text-[#422268]" style={{ fontFamily: "'Inter', sans-serif" }}>
Enter Donation Amount