-
Notifications
You must be signed in to change notification settings - Fork 320
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
1 parent
37d7876
commit 8f523d0
Showing
56 changed files
with
1,227 additions
and
385 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
VITE_API_URL=http://localhost:4000 | ||
VITE_HMAC_SECRET_KEY= | ||
VITE_HMAC_SECRET_KEY= | ||
VITE_REQUEST_CACHE=false |
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 |
---|---|---|
@@ -1,41 +1,45 @@ | ||
import { useState } from "react" | ||
import { ArrowUp } from "lucide-react" | ||
import { useState } from 'react'; | ||
import { ArrowUp } from 'lucide-react'; | ||
|
||
const BackToTop = () => { | ||
const [isVisible, setVisibility] = useState(false); | ||
|
||
const BackToTop =() => { | ||
|
||
const [isVisible, setVisibility] = useState(false) | ||
|
||
const scrollToTop = () => { | ||
let root = document.getElementById('root') | ||
if (!root) {return} | ||
|
||
root.scrollTo({top:0, behavior:"smooth"}) | ||
|
||
const scrollToTop = () => { | ||
const root = document.getElementById('root'); | ||
if (!root) { | ||
return; | ||
} | ||
|
||
document.getElementById("root")?.addEventListener('scroll', (e) => { | ||
if (e.target === null) {return} | ||
let CurrentScrollHeight = (e.target as HTMLElement).scrollTop | ||
let WindowHeight = window.innerHeight | ||
root.scrollTo({ top: 0, behavior: 'smooth' }); | ||
}; | ||
|
||
if ( CurrentScrollHeight > WindowHeight / 2) { | ||
setVisibility(true) | ||
} else { | ||
setVisibility(false) | ||
} | ||
}) | ||
document.getElementById('root')?.addEventListener('scroll', (e) => { | ||
if (e.target === null) { | ||
return; | ||
} | ||
const CurrentScrollHeight = (e.target as HTMLElement).scrollTop; | ||
const WindowHeight = window.innerHeight; | ||
|
||
if (CurrentScrollHeight > WindowHeight / 2) { | ||
setVisibility(true); | ||
} else { | ||
setVisibility(false); | ||
} | ||
}); | ||
|
||
return (isVisible && ( | ||
<button | ||
className=" fixed ease-in-out hidden sm:flex justify-center items-center duration-300 | ||
return ( | ||
isVisible && ( | ||
<button | ||
className=" fixed ease-in-out hidden sm:flex justify-center items-center duration-300 | ||
bg-red-600/75 focus:bg-red-700 hover:bg-red-700 z-[100] shadow-slate-600/75 | ||
right-6 bottom-6 rounded-full shadow-md | ||
w-12 h-12 " | ||
onClick={scrollToTop} | ||
><ArrowUp color="white" /></button> | ||
)); | ||
} | ||
onClick={scrollToTop} | ||
> | ||
<ArrowUp color="white" /> | ||
</button> | ||
) | ||
); | ||
}; | ||
|
||
export { BackToTop }; |
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,45 @@ | ||
import { useEffect, useState } from 'react'; | ||
|
||
import { IDonationCart } from './types'; | ||
import { Sheet, SheetContent } from '../ui/sheet'; | ||
import { DonationCartForm, DonationSuccess } from './components'; | ||
|
||
const DonationCart = (props: IDonationCart) => { | ||
const { onClose, opened, shelterId } = props; | ||
const [donationOrderId, setDonationOrderId] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
const el = document.querySelector('header'); | ||
if (el) { | ||
if (opened) { | ||
el?.classList.remove('z-[100]'); | ||
el?.classList.add('z-0'); | ||
} else { | ||
el?.classList.remove('z-0'); | ||
el?.classList.add('z-[100]'); | ||
} | ||
} | ||
}, [opened]); | ||
|
||
useEffect(() => { | ||
if (!opened) setDonationOrderId(null); | ||
}, [opened]); | ||
|
||
return ( | ||
<Sheet open={opened} onOpenChange={onClose}> | ||
<SheetContent side="right" className="z-[120] flex flex-col pb-0 px-0"> | ||
{donationOrderId ? ( | ||
<DonationSuccess donationOrderId={donationOrderId} /> | ||
) : ( | ||
<DonationCartForm | ||
onCancel={onClose} | ||
shelterId={shelterId} | ||
onSuccess={(orderId) => setDonationOrderId(orderId)} | ||
/> | ||
)} | ||
</SheetContent> | ||
</Sheet> | ||
); | ||
}; | ||
|
||
export { DonationCart }; |
Oops, something went wrong.