From 168e8f82f6f44c277f79467f2eb92aa3fc21a31b Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 25 Dec 2023 21:15:31 +0100 Subject: [PATCH] Use "Footer" to prevent fab overlapping the last item (#517) --- src/components/manga/ChapterList.tsx | 35 +++++++++------------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/components/manga/ChapterList.tsx b/src/components/manga/ChapterList.tsx index 11b9dddbe1..6dc08949dc 100644 --- a/src/components/manga/ChapterList.tsx +++ b/src/components/manga/ChapterList.tsx @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { CircularProgress, Stack, styled, Tooltip } from '@mui/material'; +import { Box, CircularProgress, Stack, styled, Tooltip } from '@mui/material'; import Typography from '@mui/material/Typography'; import React, { ComponentProps, useMemo, useState } from 'react'; import { Virtuoso } from 'react-virtuoso'; @@ -310,29 +310,16 @@ export const ChapterList: React.FC = ({ manga, isRefreshing }) => { // 900 is the md breakpoint in MUI overflowY: window.innerWidth < 900 ? 'visible' : 'auto', }} - totalCount={visibleChapters.length + 1} - itemContent={(index: number) => { - // hacky way of adding padding to the bottom of the list, so the FAB doesn't overlay the last chapter - // since I was unable to find another solution on how to achieve this - if (index === visibleChapters.length) { - return ( -
- ); - } - - return ( - handleSelection(index)} - /> - ); - }} + components={{ Footer: () => }} + totalCount={visibleChapters.length} + itemContent={(index: number) => ( + handleSelection(index)} + /> + )} useWindowScroll={window.innerWidth < 900} overscan={window.innerHeight * 0.5} />