performance enhancements

This commit is contained in:
cv
2021-05-02 15:05:32 +02:00
parent 7f94907056
commit 9715e13152
11 changed files with 137 additions and 63 deletions
+9 -5
View File
@@ -1,3 +1,4 @@
import { memo, useCallback } from 'react';
import { FiChevronDown } from 'react-icons/fi';
import {
Button,
@@ -9,9 +10,9 @@ import {
} from '@chakra-ui/react';
import AddIconBtn from '../../common/components/buttons/AddIconBtn';
import style from './EventListMenu.module.css';
import MenuActionButtons from '../editors/list/MenuActionButtons';
export default function EventListMenu(props) {
const { eventsHandler } = props;
const EventListMenu = ({ eventsHandler }) => {
const buttonProps = {
size: 'sm',
variant: 'outline',
@@ -27,9 +28,9 @@ export default function EventListMenu(props) {
backgroundColor: 'rgba(255,255,255,0.67)',
};
const addHandler = () => {
const addHandler = useCallback(() => {
eventsHandler('add', { type: 'event', order: 0 });
};
}, [eventsHandler]);
return (
<div className={style.headerButtons}>
@@ -58,6 +59,9 @@ export default function EventListMenu(props) {
</MenuList>
</Menu>
<AddIconBtn clickhandler={addHandler} size='sm' />
{/* <MenuActionButtons size='sm' /> */}
</div>
);
}
};
export default memo(EventListMenu);