import EmptyResult from "components/EmptyResult"; import Pagination from "components/Pagination"; import useDbList from "libs/hooks/useDbList"; import Link from "next/link"; import styles from "./index.module.scss"; import Item from "./Item"; interface LibrayListProps { type: string; } export default function LibrayList({ type }: LibrayListProps) { const isHistory = type === "History"; const [historyList, historyPages, fetchHistory] = useDbList( "history", isHistory ? "historyIsReading" : "historyIsFavorite", "prev", isHistory ? [ [1, 0], [1, new Date()], ] : [[1], [1]] ); const handlePageChange = ( event: React.ChangeEvent, value: number ) => { fetchHistory(value - 1); }; const refreshList = () => { fetchHistory(historyPages.page); }; return ( <> {historyList.length ? ( ) : (

EXPLORE NOW

)} {historyPages.total > historyPages.pageSize ? ( ) : null} ); }