28 of 35 branches covered (80.0%)
Branch coverage included in aggregate %.
429 of 482 new or added lines in 19 files covered. (89.0%)
1 existing line in 1 file now uncovered.505 of 568 relevant lines covered (88.91%)
2.3 hits per line
|
import { ChevronLeft } from "lucide-react";
|
1✔ |
|
import { useNavigate } from "react-router-dom";
|
1✔ |
|
|
1✔ |
|
interface BackBtnType { |
1✔ |
|
url?: string;
|
1✔ |
|
isBordered: boolean;
|
1✔ |
|
otherStyles?: string;
|
1✔ |
|
title: string |
1✔ |
|
} |
1✔ |
|
|
1✔ |
|
const BackButton = ({ url, isBordered, otherStyles, title }: BackBtnType) => {
|
|
|
const navigate = useNavigate();
|
3✔ |
|
|
3✔ |
|
const handleNavigation = () => {
|
3✔ |
NEW
|
if (url) {
|
× |
NEW
|
navigate(url); |
× |
NEW
|
} else {
|
× |
NEW
|
navigate(-1);
|
× |
NEW
|
} |
× |
NEW
|
}; |
× |
|
return (
|
3✔ |
|
<button |
3✔ |
|
onClick={handleNavigation} |
3✔ |
|
className={`flex-center text-xs ${
|
3✔ |
|
isBordered |
3✔ |
|
? "border border-overlay text-neutral-black/55 py-2 px-3.5 rounded-lg bg-overlay/25 hover:bg-overlay/35 shadow-inner"
|
|
NEW
|
: ""
|
× |
|
} ${otherStyles}`}
|
3✔ |
|
> |
3✔ |
|
<ChevronLeft size={18} /> {title}
|
3✔ |
|
</button> |
3✔ |
|
); |
3✔ |
|
}; |
3✔ |
|
|
1✔ |
|
export default BackButton; |
1✔ |