/* * Copyright (C) Contributors to the Suwayomi project * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import MoreHoriz from '@mui/icons-material/MoreHoriz'; import { Fab, Menu, Box } from '@mui/material'; import React, { useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { DEFAULT_FAB_STYLE } from '@/components/util/StyledFab'; import { TranslationKey } from '@/typings.ts'; interface SelectionFABProps { children: (handleClose: () => void) => React.ReactNode; selectedItemsCount: number; title: TranslationKey; } export const SelectionFAB: React.FC = ({ children, selectedItemsCount, title }) => { const { t } = useTranslation(); const anchorEl = useRef(); const [open, setOpen] = useState(false); const handleClose = () => setOpen(false); return ( setOpen(true)}> {`${selectedItemsCount} ${t(title, { count: selectedItemsCount })}`} {children(handleClose)} ); };