Skip to content

Commit

Permalink
Merge pull request #44 from Chimoney/feat/new-landing-page
Browse files Browse the repository at this point in the history
Fix linter issues
  • Loading branch information
uchibeke authored Oct 27, 2024
2 parents 320638d + 25be465 commit 25400fc
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 187 deletions.
5 changes: 3 additions & 2 deletions open-giving/src/components/DonationForm.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useEffect } from 'react';

import useDonation from '../hooks/useDonation';
import DonateButton from './landingpage/donateButton';
import CopyWithTooltip from './landingpage/copy';
import { sanitizeNumericInput } from '../utils/paymentMethods';

import CopyWithTooltip from './landingpage/copy';
import DonateButton from './landingpage/donateButton';

const dev = process.env.NODE_ENV == 'development';
const DonationForm = React.memo(
({ method, index, setSnackbarMessage, setSnackbarOpen, NPOName }) => {
Expand Down
3 changes: 2 additions & 1 deletion open-giving/src/components/Header.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import useIsMobileScreen from '@/hooks/mobile';
import Image from 'next/image';
import React from 'react';
import { FaGithub } from 'react-icons/fa';

import useIsMobileScreen from '@/hooks/mobile';

const Header = () => {
const isMobile = useIsMobileScreen();
return (
Expand Down
7 changes: 4 additions & 3 deletions open-giving/src/components/Layout.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Image from 'next/image';
import React from 'react';
import TestModeSwitcher from './TestModeSwitcher';
import Header from './Header';
import { FaHeart } from 'react-icons/fa6';
import Image from 'next/image';

import Header from './Header';
import TestModeSwitcher from './TestModeSwitcher';
const Layout = ({ children, plain = false }) => {
return (
<div className="min-h-screen bg-gray-50 w-full">
Expand Down
18 changes: 12 additions & 6 deletions open-giving/src/components/NonProfitDialog.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import Image from 'next/image';
import React, { useState } from 'react';
import { MdClose, MdLocationOn } from 'react-icons/md';
import { FaRegCalendarAlt } from 'react-icons/fa';
import DonationForm from './DonationForm';
import Image from 'next/image';
import { FaAngleRight, FaArrowLeft } from 'react-icons/fa6';
import { MdClose, MdLocationOn } from 'react-icons/md';

import DonationForm from './DonationForm';

import useIsMobileScreen from '@/hooks/mobile';
import {
filterDonationMethods,
formatPaymentMethodName,
getIconByMethod,
} from '@/utils/paymentMethods';
import useIsMobileScreen from '@/hooks/mobile';

const Modal = ({ open, onClose, children }) => {
if (!open) return null;
Expand Down Expand Up @@ -39,14 +41,14 @@ const NonProfitDialog = ({
nonProfit?.logo || defaultLogo
);
const [selectedPaymentType, setSelectedPaymentType] = useState(null);
const isMobile = useIsMobileScreen();

const handleDialogImageError = () => {
setDialogImgSrc(defaultLogo);
};

if (!nonProfit) return null;

const isMobile = useIsMobileScreen();
const getPaymentID = (method) => {
if (!method.paymentID) {
return true;
Expand Down Expand Up @@ -102,7 +104,10 @@ const NonProfitDialog = ({
},
].map((i) => {
return (
<span className="bg-[#EDEAEC] font-sans flex flex-row items-center px-[11px] py-[6px] text-[#4A4152] font-medium text-[11px] md:text-[12px] rounded-full gap-1">
<span
key={i.name}
className="bg-[#EDEAEC] font-sans flex flex-row items-center px-[11px] py-[6px] text-[#4A4152] font-medium text-[11px] md:text-[12px] rounded-full gap-1"
>
{i.icon} {i.name}
</span>
);
Expand Down Expand Up @@ -186,6 +191,7 @@ const NonProfitDialog = ({
{options.map((i) => {
return (
<button
key={i.type}
onClick={() => handleSelect(i.type)}
className="border w-full px-[12px] py-[13px] md:py-[11px] mb-[10px] border-[#C4C4C470] bg-[#F1E7F208] rounded-[8px] flex flex-row items-center justify-between"
>
Expand Down
2 changes: 1 addition & 1 deletion open-giving/src/components/TestModeSwitcher.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useRouter } from 'next/router';
import React from 'react';
import { FaToggleOn, FaToggleOff } from 'react-icons/fa';
import { FaToggleOff, FaToggleOn } from 'react-icons/fa';

const TestModeSwitcher = () => {
const router = useRouter();
Expand Down
1 change: 1 addition & 0 deletions open-giving/src/components/landingpage/Hero.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { FaHeart } from 'react-icons/fa6';

import { HeroContent } from '../constants';

export const Hero = () => {
Expand Down
7 changes: 5 additions & 2 deletions open-giving/src/components/landingpage/Orgs.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { FaHeart } from 'react-icons/fa6';
import { useState } from 'react';
import { FaHeart } from 'react-icons/fa6';
import { LuSearchSlash } from 'react-icons/lu';

import QRCodeComponent from '../QRCodeComponent';

import { filterDonationMethods } from '@/utils/paymentMethods';
import { LuSearchSlash } from 'react-icons/lu';


const OrgCard = ({ org, onLearnMore, showQRCode }) => {
const paymentOptions = filterDonationMethods(org);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import useIsMobileScreen from '@/hooks/mobile';
import Image from 'next/image';

import useIsMobileScreen from '@/hooks/mobile';

export const SelectDonationMethod = ({
paymentMethods,
handleToggle,
Expand Down
1 change: 1 addition & 0 deletions open-giving/src/components/landingpage/donateButton.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { FaHeart } from 'react-icons/fa6';

import Loader from './Loader';

const DonateButton = ({
Expand Down
2 changes: 1 addition & 1 deletion open-giving/src/hooks/mobile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useEffect, useState } from 'react';

const useIsMobileScreen = (mobileBreakpoint = 768) => {
const [isMobile, setIsMobile] = useState(false);
Expand Down
163 changes: 0 additions & 163 deletions open-giving/src/pages/index-old.js

This file was deleted.

14 changes: 7 additions & 7 deletions open-giving/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Hero } from '@/components/landingpage/Hero';

import { DonationOrganizations } from '@/components/landingpage/Orgs';
import { SelectDonationMethod } from '@/components/landingpage/SelectDonationMethod';
import Layout from '@/components/Layout';
import { useRouter } from 'next/router';
import { useState, useEffect } from 'react';
import { verifiedNonprofits } from 'non-profit-donations';
import { useEffect, useState } from 'react';

import Layout from '@/components/Layout';
import NonProfitDialog from '@/components/NonProfitDialog';
import { donationMethods } from '@/components/constants';
import { Hero } from '@/components/landingpage/Hero';
import { DonationOrganizations } from '@/components/landingpage/Orgs';
import { SelectDonationMethod } from '@/components/landingpage/SelectDonationMethod';
import Pagination from '@/components/landingpage/pagination';
import NonProfitDialog from '@/components/NonProfitDialog';
import Snackbar from '@/components/landingpage/snackbar';

const ITEMS_PER_PAGE = 9;
Expand Down

0 comments on commit 25400fc

Please sign in to comment.