744 of 913 branches covered (81.49%)
Branch coverage included in aggregate %.
175 of 185 new or added lines in 10 files covered. (94.59%)
7 existing lines in 1 file now uncovered.8401 of 8946 relevant lines covered (93.91%)
18.3 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();
|
38✔ |
13 |
|
38✔ |
14 |
const handleNavigation = () => {
|
|
15 |
if (url) {
|
1✔ |
16 |
navigate(url); |
1✔ |
17 |
} else {
|
|
NEW
|
navigate('/');
|
× |
19 |
} |
× |
20 |
}; |
1✔ |
21 |
return (
|
38✔ |
22 |
<button |
38✔ |
23 |
onClick={handleNavigation} |
38✔ |
24 |
className={`flex-center text-xs ${
|
38✔ |
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}`}
|
38✔ |
29 |
> |
38✔ |
30 |
<ChevronLeft size={18} /> {title}
|
38✔ |
31 |
</button> |
38✔ |
32 |
); |
38✔ |
33 |
}; |
38✔ |
34 |
|
1✔ |
35 |
export default BackButton; |
1✔ |