Files
suwayomi-material-you-webui/src/components/manga/ChaptersToolbarMenu.tsx
T

40 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-11-09 18:09:15 +01:00
/*
* 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 FilterList from '@mui/icons-material/FilterList';
import { IconButton } from '@mui/material';
2022-11-09 18:09:15 +01:00
import * as React from 'react';
2023-02-05 16:15:20 +01:00
import ChapterOptions from 'components/manga/ChapterOptions';
import { isFilterActive } from 'components/manga/util';
import { ChapterListOptions, ChapterOptionsReducerAction } from 'typings';
2022-11-09 18:09:15 +01:00
interface IProps {
2023-02-06 10:06:33 +01:00
options: ChapterListOptions;
optionsDispatch: React.Dispatch<ChapterOptionsReducerAction>;
2022-11-09 18:09:15 +01:00
}
const ChaptersToolbarMenu = ({ options, optionsDispatch }: IProps) => {
const [open, setOpen] = React.useState(false);
const isFiltered = isFilterActive(options);
return (
<>
<IconButton onClick={() => setOpen(true)}>
<FilterList color={isFiltered ? 'warning' : undefined} />
2022-11-09 18:09:15 +01:00
</IconButton>
<ChapterOptions
open={open}
onClose={() => setOpen(false)}
options={options}
optionsDispatch={optionsDispatch}
/>
</>
);
};
export default ChaptersToolbarMenu;