Files
Mav-Mobile-UI/src/components/UI/NavigationArrow.tsx

65 lines
1.8 KiB
TypeScript
Raw Normal View History

import { faArrowLeft, faArrowRight } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "react-router";
type NavigationArrowProps = {
side: string;
2025-08-18 12:53:30 +01:00
settingsPage?: boolean;
};
2025-08-18 12:53:30 +01:00
const NavigationArrow = ({ side, settingsPage }: NavigationArrowProps) => {
const navigate = useNavigate();
const navigationDest = (side: string) => {
2025-08-18 12:53:30 +01:00
if (settingsPage) {
navigate("/");
2025-08-18 12:53:30 +01:00
return;
}
2025-08-22 10:38:28 +01:00
if (side === "Front") {
2025-08-18 12:53:30 +01:00
navigate("/front-camera-settings");
2025-08-22 10:38:28 +01:00
} else if (side === "Rear") {
navigate("/Rear-Camera-settings");
}
};
2025-08-18 12:53:30 +01:00
if (settingsPage) {
return (
<>
{side === "CameraFront" ? (
2025-08-18 12:53:30 +01:00
<FontAwesomeIcon
icon={faArrowRight}
2025-09-12 08:21:52 +01:00
className="absolute top-[50%] right-[2%] backdrop-blur-md hover:cursor-pointer animate-bounce z-30"
2025-08-18 12:53:30 +01:00
onClick={() => navigationDest(side)}
/>
) : (
<FontAwesomeIcon
icon={faArrowLeft}
2025-09-12 08:21:52 +01:00
className="absolute top-[50%] left-[2%] backdrop-blur-md hover:cursor-pointer animate-bounce z-30"
2025-08-18 12:53:30 +01:00
onClick={() => navigationDest(side)}
/>
)}
</>
);
}
return (
<>
2025-08-22 10:38:28 +01:00
{side === "Front" ? (
<FontAwesomeIcon
icon={faArrowLeft}
2025-09-12 08:21:52 +01:00
className="absolute top-[50%] left-[2%] backdrop-blur-md hover:cursor-pointer animate-bounce z-30"
onClick={() => navigationDest(side)}
/>
) : (
<FontAwesomeIcon
icon={faArrowRight}
2025-09-12 08:21:52 +01:00
className="absolute top-[50%] right-[2%] backdrop-blur-md hover:cursor-pointer animate-bounce z-30"
onClick={() => navigationDest(side)}
/>
)}
</>
);
};
export default NavigationArrow;