upd: scroll
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ScrollProvider, WrapLayout } from "@/module/_global"
|
||||
import { WrapLayout } from "@/module/_global"
|
||||
import { funDetectCookies, funGetUserByCookies } from "@/module/auth"
|
||||
import _ from "lodash"
|
||||
import { redirect } from "next/navigation"
|
||||
@@ -11,9 +11,7 @@ export default async function Layout({ children }: { children: React.ReactNode }
|
||||
return (
|
||||
<>
|
||||
<WrapLayout role={user.idUserRole} theme={user.theme} user={user.id}>
|
||||
<ScrollProvider>
|
||||
{children}
|
||||
</ScrollProvider>
|
||||
</WrapLayout>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
MantineProvider,
|
||||
rem,
|
||||
} from "@mantine/core";
|
||||
import { WARNA } from "@/module/_global";
|
||||
import { ScrollProvider, WARNA } from "@/module/_global";
|
||||
import { Lato } from "next/font/google";
|
||||
import '@mantine/carousel/styles.css';
|
||||
import { Toaster } from 'react-hot-toast';
|
||||
@@ -43,10 +43,13 @@ export default function RootLayout({
|
||||
overflowY: "auto",
|
||||
}}>
|
||||
<Toaster />
|
||||
<ScrollProvider>
|
||||
<LayoutBackground>
|
||||
{children}
|
||||
</LayoutBackground>
|
||||
</ScrollProvider>
|
||||
</Box>
|
||||
|
||||
</MantineProvider>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -31,13 +31,11 @@ export default function ListAnnouncement() {
|
||||
setLoading(true)
|
||||
const response = await funGetAllAnnouncement('?search=' + searchQuery + '&page=' + isPage)
|
||||
if (response.success) {
|
||||
// if (response.data.length > 0) {
|
||||
if (isPage == 1) {
|
||||
setIsData(response?.data)
|
||||
} else {
|
||||
setIsData([...isData, ...response?.data])
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
toast.error(response.message);
|
||||
}
|
||||
@@ -79,7 +77,6 @@ export default function ListAnnouncement() {
|
||||
const scrollTop = containerRef.current.scrollTop;
|
||||
const containerHeight = containerRef.current.clientHeight;
|
||||
const scrollHeight = containerRef.current.scrollHeight;
|
||||
|
||||
if (scrollTop + containerHeight >= scrollHeight) {
|
||||
setPage(isPage + 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user