'use client' import colors from '@/con/colors'; import { Box, Button, Center, Group, Pagination, Paper, Skeleton, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Text, Title } from '@mantine/core'; import { useShallowEffect } from '@mantine/hooks'; import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react'; import { useRouter } from 'next/navigation'; import { useState } from 'react'; import { useProxy } from 'valtio/utils'; import HeaderSearch from '../../../_com/header'; import stateGallery from '../../../_state/desa/gallery'; function Foto() { const [search, setSearch] = useState(""); return ( } value={search} onChange={(e) => setSearch(e.currentTarget.value)} /> ); } function ListFoto({ search }: { search: string }) { const FotoState = useProxy(stateGallery.foto) const router = useRouter(); const { data, page, totalPages, loading, load, } = FotoState.findMany; useShallowEffect(() => { load(page, 10, search) }, [page, search]) const filteredData = data || [] if (loading || !data) { return ( ) } return ( Daftar Foto Judul Foto Tanggal Deskripsi Aksi {filteredData.length > 0 ? ( filteredData.map((item) => ( {item.name} {new Date(item.createdAt).toLocaleDateString('id-ID', { day: 'numeric', month: 'long', year: 'numeric', })} )) ) : (
Tidak ada foto yang cocok
)}
{ load(newPage, 10) window.scrollTo({ top: 0, behavior: 'smooth' }) }} total={totalPages} mt="md" mb="md" color="blue" radius="md" />
); } export default Foto;