28 of 35 branches covered (80.0%)
Branch coverage included in aggregate %.
447 of 512 new or added lines in 22 files covered. (87.3%)
513 of 587 relevant lines covered (87.39%)
2.02 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✔ |