Retain contract address while switching between link tabs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import clsx from 'clsx'
|
||||
import { Anchor } from 'components/Anchor'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
export interface LinkTabProps {
|
||||
title: string
|
||||
@@ -11,6 +12,10 @@ export interface LinkTabProps {
|
||||
export const LinkTab = (props: LinkTabProps) => {
|
||||
const { title, description, href, isActive } = props
|
||||
|
||||
// get contract address from the router
|
||||
const router = useRouter()
|
||||
const { contractAddress } = router.query
|
||||
|
||||
return (
|
||||
<Anchor
|
||||
className={clsx(
|
||||
@@ -19,7 +24,7 @@ export const LinkTab = (props: LinkTabProps) => {
|
||||
isActive ? 'border-plumbus' : 'border-transparent',
|
||||
isActive ? 'bg-plumbus/5 hover:bg-plumbus/10' : 'hover:bg-white/5',
|
||||
)}
|
||||
href={href}
|
||||
href={href + (contractAddress ? `?contractAddress=${contractAddress as string}` : '')}
|
||||
>
|
||||
<h4 className="font-bold">{title}</h4>
|
||||
<span className="text-sm text-white/80 line-clamp-2">{description}</span>
|
||||
|
||||
Reference in New Issue
Block a user