error handling + cleanup

- handle case where localstorage does not contain item
- eventhandler updates when data changes
This commit is contained in:
cv
2021-05-20 11:20:18 +02:00
parent c912a61b57
commit 438bceba57
5 changed files with 110 additions and 100 deletions
@@ -0,0 +1,43 @@
import { Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/menu';
import { IconButton } from '@chakra-ui/button';
import { FiZap, FiPlus, FiClock, FiMinusCircle } from 'react-icons/fi';
export default function MenuActionButtons(props) {
const { actionHandler } = props;
const menuStyle = {
color: '#000000',
backgroundColor: 'rgba(255,255,255,1)',
};
return (
<Menu isLazy lazyBehavior='unmount'>
<MenuButton
as={IconButton}
aria-label='Options'
size={props.size || 'xs'}
icon={<FiZap />}
_expanded={{ bg: 'pink.300', color: 'white' }}
_focus={{ boxShadow: 'none' }}
backgroundColor={'orange.200'}
color={'orange.500'}
/>
<MenuList style={menuStyle}>
{/* <MenuItem icon={<FiTrash2 />} onClick={props.deleteAllHandler}>
Delete All
</MenuItem> */}
<MenuItem icon={<FiPlus />} onClick={() => actionHandler('event')}>
Event first
</MenuItem>
<MenuItem icon={<FiClock />} onClick={() => actionHandler('delay')}>
Delay first
</MenuItem>
<MenuItem
icon={<FiMinusCircle />}
onClick={() => actionHandler('block')}
>
Block first
</MenuItem>
</MenuList>
</Menu>
);
}