mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 05:59:34 +02:00
chore: rotation options
This commit is contained in:
20
src/components/BackButton.tsx
Normal file
20
src/components/BackButton.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { IconButton } from '@mui/material';
|
||||
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
||||
import { useNavigate, useNavigationType } from 'react-router-dom';
|
||||
|
||||
const BackButton = () => {
|
||||
const navigate = useNavigate();
|
||||
const navigationType = useNavigationType(); // Check if there is a history state
|
||||
const disabled = navigationType === 'POP';
|
||||
const handleBack = () => {
|
||||
navigate(-1);
|
||||
};
|
||||
|
||||
return (
|
||||
<IconButton onClick={handleBack} disabled={disabled}>
|
||||
<ArrowBackIcon color={disabled ? 'action' : 'primary'} />
|
||||
</IconButton>
|
||||
);
|
||||
};
|
||||
|
||||
export default BackButton;
|
Reference in New Issue
Block a user