Добавление открытия / закрытия модалки создания задачи (#78)

* Добавить открытие\закрытие модалки создания задачи #63

написал каркас функции и рендеринга,
настроил открытие и закрытие модалки
This commit is contained in:
Max Nikitin
2021-01-28 11:45:29 +03:00
committed by GitHub
parent 4f389c47f5
commit c0b21882ce
10 changed files with 98 additions and 56 deletions

View File

@ -0,0 +1,26 @@
import {ListItem, ListItemText} from '@material-ui/core';
import React, {memo, useCallback} from 'react';
import {useHistory} from 'react-router-dom';
type PopupListItemProps = {
item: string;
url: string;
setOpen: (isOpen: boolean) => void;
};
const PopupListItem: React.FC<PopupListItemProps> = ({item, url, setOpen}) => {
const history = useHistory();
const handleClick = useCallback(() => {
setOpen(false);
history.push(url);
}, [history, setOpen, url]);
return (
<ListItem button onClick={handleClick}>
<ListItemText primary={item} />
</ListItem>
);
};
export default memo(PopupListItem);