646 of 803 branches covered (80.45%)
Branch coverage included in aggregate %.
147 of 157 new or added lines in 11 files covered. (93.63%)
10 existing lines in 2 files now uncovered.7332 of 7861 relevant lines covered (93.27%)
13.94 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();
|
36✔ |
13 |
|
36✔ |
14 |
const handleNavigation = () => {
|
|
15 |
if (url) {
|
1✔ |
16 |
navigate(url); |
1✔ |
17 |
} else {
|
|
NEW
|
navigate('/');
|
× |
19 |
} |
× |
20 |
}; |
1✔ |
21 |
return (
|
36✔ |
22 |
<button |
36✔ |
23 |
onClick={handleNavigation} |
36✔ |
24 |
className={`flex-center text-xs ${
|
36✔ |
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 |
: ''
|
25✔ |
28 |
} ${otherStyles}`}
|
36✔ |
29 |
> |
36✔ |
30 |
<ChevronLeft size={18} /> {title}
|
36✔ |
31 |
</button> |
36✔ |
32 |
); |
36✔ |
33 |
}; |
36✔ |
34 |
|
1✔ |
35 |
export default BackButton; |
1✔ |