67 lines
1.8 KiB
TypeScript
67 lines
1.8 KiB
TypeScript
import { faArrowLeft, faArrowRight } from "@fortawesome/free-solid-svg-icons";
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
import { useNavigate } from "react-router";
|
|
|
|
type NavigationArrowProps = {
|
|
side: string | undefined;
|
|
settingsPage?: boolean;
|
|
};
|
|
|
|
const NavigationArrow = ({ side, settingsPage }: NavigationArrowProps) => {
|
|
const navigate = useNavigate();
|
|
|
|
const navigationDest = (side: string | undefined) => {
|
|
if (settingsPage) {
|
|
navigate("/");
|
|
return;
|
|
}
|
|
|
|
if (side === "Front") {
|
|
navigate("/camera-settings");
|
|
} else if (side === "Rear") {
|
|
navigate("/Rear-Camera-settings");
|
|
}
|
|
};
|
|
|
|
if (settingsPage) {
|
|
return (
|
|
<>
|
|
{side === "CameraA" ? (
|
|
<FontAwesomeIcon
|
|
size="2xl"
|
|
icon={faArrowRight}
|
|
className="absolute top-[50%] right-[2%] backdrop-blur-lg hover:cursor-pointer animate-bounce z-30"
|
|
onClick={() => navigationDest("Front")}
|
|
/>
|
|
) : (
|
|
<FontAwesomeIcon
|
|
icon={faArrowLeft}
|
|
size="2xl"
|
|
className="absolute top-[50%] left-[2%] backdrop-blur-md hover:cursor-pointer animate-bounce z-30"
|
|
onClick={() => navigationDest("Rear")}
|
|
/>
|
|
)}
|
|
</>
|
|
);
|
|
}
|
|
return (
|
|
<>
|
|
<FontAwesomeIcon
|
|
icon={faArrowLeft}
|
|
size="2xl"
|
|
className="absolute top-[50%] left-[2%] backdrop-blur-md hover:cursor-pointer animate-bounce z-100 "
|
|
onClick={() => navigationDest("Front")}
|
|
/>
|
|
|
|
<FontAwesomeIcon
|
|
icon={faArrowRight}
|
|
size="2xl"
|
|
className="absolute top-[50%] right-[2%] backdrop-blur-md hover:cursor-pointer animate-bounce z-100"
|
|
onClick={() => navigationDest("Rear")}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default NavigationArrow;
|