34 of 41 branches covered (82.93%)
Branch coverage included in aggregate %.
387 of 443 new or added lines in 13 files covered. (87.36%)
1 existing line in 1 file now uncovered.489 of 600 relevant lines covered (81.5%)
5.11 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();
|
9✔ |
|
|
9✔ |
|
const handleNavigation = () => {
|
9✔ |
NEW
|
if (url) {
|
× |
NEW
|
navigate(url); |
× |
NEW
|
} else {
|
× |
NEW
|
navigate(-1);
|
× |
NEW
|
} |
× |
NEW
|
}; |
× |
|
return (
|
9✔ |
|
<button |
9✔ |
|
onClick={handleNavigation} |
9✔ |
|
className={`flex-center text-xs ${
|
9✔ |
|
isBordered |
9✔ |
|
? "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}`}
|
9✔ |
|
> |
9✔ |
|
<ChevronLeft size={18} /> {title}
|
9✔ |
|
</button> |
9✔ |
|
); |
9✔ |
|
}; |
9✔ |
|
|
1✔ |
|
export default BackButton; |
1✔ |