This repository has no description
572 B
26 lines
1'use client';
2
3import { ActionIcon } from '@mantine/core';
4import { useRouter } from 'next/navigation';
5import { useNavHistory } from '@/providers/navHistory';
6import { IoArrowBack } from 'react-icons/io5';
7
8export default function BackButton() {
9 const { canGoBack } = useNavHistory();
10 const router = useRouter();
11
12 if (!canGoBack) return null;
13
14 return (
15 <ActionIcon
16 onClick={() => router.back()}
17 variant="subtle"
18 size="lg"
19 color="gray"
20 radius={'xl'}
21 aria-label="Go back"
22 >
23 <IoArrowBack />
24 </ActionIcon>
25 );
26}