Skip to content

Commit

Permalink
build: nextjs v13 link component
Browse files Browse the repository at this point in the history
  • Loading branch information
aahna-ashina committed Aug 22, 2024
1 parent 30f2822 commit fb5ef8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 43 deletions.
25 changes: 4 additions & 21 deletions ui/components/GradientLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,9 @@ import Link from 'next/link'
import React from 'react'

export default function GradientLink({ text, href, textSize }: any) {
if (href?.charAt(0) === '/') {
return (
<Link href={href}>
<a
className={`text-${textSize} font-medium bg-gradient-to-r from-n3blue to-n3green text-transparent bg-clip-text`}
>
{text}
</a>
</Link>
)
} else {
return (
<a
className={`text-${textSize} font-medium bg-gradient-to-r from-n3blue to-n3green text-transparent bg-clip-text`}
href={href}
rel="noopener noreferrer"
target="_blank"
>
return (
<Link href={href} className={`text-${textSize} font-medium bg-gradient-to-r from-n3blue to-n3green text-transparent bg-clip-text`}>
{text}
</a>
)
}
</Link>
)
}
34 changes: 12 additions & 22 deletions ui/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ export default function Layout({ children }: any) {
<div className="pl-6 pt-2 cursor-pointer">
<div className="flex-none hidden lg:block">
<Link href="/" passHref>
<a>
<Image src={Logo} alt="Logo" />
</a>
<Image src={Logo} alt="Logo" />
</Link>
</div>
<div className="flex-none lg:hidden">
Expand Down Expand Up @@ -163,15 +161,13 @@ export default function Layout({ children }: any) {
<div className="mt-6 py-4 hidden lg:block">
<div className="px-8 pt-2 cursor-pointer">
<Link href="/" passHref>
<a>
<span>
<Image src={Logo} alt="Logo" />
</span>
{/* Logo placeholder for Dark Mode */}
{/* <span className="dark:hidden">
<Image src={LogoDark} />
</span> */}
</a>
<span>
<Image src={Logo} alt="Logo" />
</span>
{/* Logo placeholder for Dark Mode */}
{/* <span className="dark:hidden">
<Image src={LogoDark} />
</span> */}
</Link>
</div>
</div>
Expand All @@ -186,16 +182,10 @@ export default function Layout({ children }: any) {
key={item.href}
>
{item.href.charAt(0) === '/' ? (
<Link href={item.href}>
<a
className={`py-4 ${
router.pathname == item.href ? 'active' : ''
} ${router.pathname !== item.href ? 'dark:hover:bg-slate-700' : ''}`}
>
{item.icon}
{item.name}
<ChevronRightIcon className="h-5 w-5 absolute right-4 opacity-50" />
</a>
<Link href={item.href} className={`py-4 ${router.pathname == item.href ? 'active' : ''} ${router.pathname !== item.href ? 'dark:hover:bg-slate-700' : ''}`}>
{item.icon}
{item.name}
<ChevronRightIcon className="h-5 w-5 absolute right-4 opacity-50" />
</Link>
) : (
<a
Expand Down

0 comments on commit fb5ef8f

Please sign in to comment.