Created
March 6, 2024 21:44
-
-
Save thinkjrs/33b653ed5723cb6a32737b39d60bda39 to your computer and use it in GitHub Desktop.
Next.js 404 Links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use client' | |
import React, { MouseEvent } from 'react' | |
import Link from 'next/link' | |
import settings from '../lib/settings' | |
export function HomeLink404() { | |
const handleClick = (e: MouseEvent<HTMLAnchorElement>, href: string) => { | |
e.preventDefault() | |
} | |
return ( | |
<Link | |
href="/" | |
onClick={(e) => handleClick(e, '/')} | |
className="hover:text-primary inline-block rounded-lg border border-white px-8 py-3 text-center text-base font-semibold text-white transition hover:bg-white" | |
> | |
Go to {settings.hostName} | |
</Link> | |
) | |
} | |
export function DashboardLink404() { | |
const handleClick = (e: MouseEvent<HTMLAnchorElement>, href: string) => { | |
e.preventDefault() | |
} | |
return ( | |
<Link | |
href="/dashboard" | |
onClick={(e) => handleClick(e, '/dashboard')} | |
className="hover:text-primary inline-block rounded-lg border border-white px-8 py-3 text-center text-base font-semibold text-white transition hover:bg-white" | |
> | |
Go to the dashboard | |
</Link> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment