148 of 180 branches covered (82.22%)
Branch coverage included in aggregate %.
388 of 428 new or added lines in 14 files covered. (90.65%)
108 existing lines in 3 files now uncovered.2661 of 3024 relevant lines covered (88.0%)
5.22 hits per line
1 |
import { ChevronLeft } from 'lucide-react'; |
1✔ |
2 |
import { useNavigate } from 'react-router-dom'; |
1✔ |
3 |
|
1✔ |
4 |
interface BackBtnType { |
1✔ |
5 |
url?: string;
|
1✔ |
6 |
isBordered?: boolean; |
1✔ |
7 |
otherStyles?: string;
|
1✔ |
8 |
title: string; |
1✔ |
9 |
} |
1✔ |
10 |
|
1✔ |
11 |
const BackButton = ({ url, isBordered, otherStyles, title }: BackBtnType) => {
|
|
12 |
const navigate = useNavigate();
|
14✔ |
13 |
|
14✔ |
14 |
const handleNavigation = () => {
|
14✔ |
UNCOV
15
|
if (url) {
|
× |
UNCOV
16
|
navigate(url); |
× |
UNCOV
17
|
} else {
|
× |
18 |
navigate(-1);
|
× |
19 |
} |
× |
UNCOV
20
|
}; |
× |
21 |
return (
|
14✔ |
22 |
<button |
14✔ |
23 |
onClick={handleNavigation} |
14✔ |
24 |
className={`flex-center text-xs ${
|
14✔ |
25 |
isBordered |
|
26 |
? 'border border-overlay text-neutral-black/55 py-2 px-3.5 rounded-lg bg-overlay/25 hover:bg-overlay/35 shadow-inner' |
|
27 |
: ''
|
4✔ |
28 |
} ${otherStyles}`}
|
14✔ |
29 |
> |
14✔ |
30 |
<ChevronLeft size={18} /> {title}
|
14✔ |
31 |
</button> |
14✔ |
32 |
); |
14✔ |
33 |
}; |
14✔ |
34 |
|
1✔ |
35 |
export default BackButton; |
1✔ |