import React, { useEffect, MouseEvent } from 'react'; import { useNavigate, Link } from 'react-router-dom'; import { observer } from 'mobx-react'; import { Box, SpeedDial, SpeedDialAction } from '@mui/material'; import { styled } from '@mui/system'; import { MdHome, MdRefresh, MdLock, MdShare, MdArrowUpward, MdAdd, } from 'react-icons/md'; import moDial from './store/app-dial'; import { toggleLock } from './store/app-lock'; interface IProps {} interface IState {} const actions = [ { icon: , name: 'Top' }, { icon: , name: 'Share' }, { icon: , name: 'Lock' }, { icon: , name: 'Refresh' }, { icon: , name: 'Home' }, ]; const DSpeedDial = styled(SpeedDial)(({ theme }) => ({ position: 'fixed', bottom: theme.spacing(3), right: theme.spacing(3.5), })); const AppDial = (props: IProps, state: IState) => { const navi = useNavigate(); useEffect(() => { console.log(navi); return () => {}; }, []); const onItem = (ev: MouseEvent, name: string) => { ev.stopPropagation(); if (name === 'Home') navi('/'); else if (name === 'Lock') toggleLock(true); else if (name === 'Refresh') window.location.reload(); }; return ( } className="app-dial"> {actions.map(action => ( onItem(ev, action.name)} /> ))} ); }; export default observer(AppDial);