scroll to top with new events

This commit is contained in:
Josh Hawkins 2024-02-23 07:34:14 -06:00
parent 6fdd9bb602
commit 774eba2a0f

View File

@ -252,19 +252,34 @@ export default function DesktopEventView({
ref={contentRef} ref={contentRef}
className="flex flex-1 flex-wrap content-start gap-2 overflow-y-auto no-scrollbar" className="flex flex-1 flex-wrap content-start gap-2 overflow-y-auto no-scrollbar"
> >
{hasUpdate && (
<div className="absolute w-full z-30">
<div className="flex justify-center items-center mr-[100px]">
<Button <Button
className={`${ className={`${
hasUpdate ? "animate-in slide-in-from-top" : "invisible" hasUpdate
} absolute text-center left-1/2 transform mt-5 z-30 bg-gray-400 text-white`} ? "animate-in slide-in-from-top duration-500"
: "invisible"
} text-center mt-5 mx-auto bg-gray-400 text-white`}
variant="secondary" variant="secondary"
onClick={() => { onClick={() => {
setHasUpdate(false); setHasUpdate(false);
pullLatestData(); pullLatestData();
if (contentRef.current) {
contentRef.current.scrollTo({
top: 0,
behavior: "smooth",
});
}
}} }}
> >
<LuRefreshCcw className="w-4 h-4 mr-2" /> <LuRefreshCcw className="w-4 h-4 mr-2" />
New Items To Review New Items To Review
</Button> </Button>
</div>
</div>
)}
<div className="w-full mr-4 md:grid md:grid-cols-3 3xl:grid-cols-4 gap-4 overflow-y-auto no-scrollbar"> <div className="w-full mr-4 md:grid md:grid-cols-3 3xl:grid-cols-4 gap-4 overflow-y-auto no-scrollbar">
{currentItems ? ( {currentItems ? (
currentItems.map((value, segIdx) => { currentItems.map((value, segIdx) => {