Files
suwayomi-material-you-webui/src/components/manga/ChaptersToolbarMenu.tsx
Daniel 96fd1cf73b remove manually created typing d ts file (#249)
* Rename file

".d.ts" files are files that are automatically generated during compilation (in case option is set) and shouldn't be created manually.

* Export types and interfaces

* Add missing imports
2023-02-24 19:10:37 +03:30

40 lines
1.3 KiB
TypeScript

/*
* 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';
import * as React from 'react';
import ChapterOptions from 'components/manga/ChapterOptions';
import { isFilterActive } from 'components/manga/util';
import { ChapterListOptions, ChapterOptionsReducerAction } from 'typings';
interface IProps {
options: ChapterListOptions;
optionsDispatch: React.Dispatch<ChapterOptionsReducerAction>;
}
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} />
</IconButton>
<ChapterOptions
open={open}
onClose={() => setOpen(false)}
options={options}
optionsDispatch={optionsDispatch}
/>
</>
);
};
export default ChaptersToolbarMenu;