import { ArrowRight } from 'iconsax-react'
import { FC } from 'react'
import { useRouter } from 'next/navigation'

type Props = {
    title: string
    href?: string
}

const TitleBack: FC<Props> = (props) => {
    const router = useRouter()
    const { title, href } = props

    return (
        <div onClick={() => href ? router.push(href) : router.back()} className='h-16 border border-border rounded-2xl flex gap-1.5 items-center px-6'>
            <ArrowRight size={20} color='#333333' />
            <div className='font-light '>{title}</div>
        </div>
    )
}

export default TitleBack