Skip to content

Commit

Permalink
token page back button
Browse files Browse the repository at this point in the history
  • Loading branch information
saml33 committed Dec 20, 2023
1 parent 517df9a commit 335beb5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
12 changes: 2 additions & 10 deletions app/(pages)/token/[slug]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ArrowLeftIcon } from '@heroicons/react/20/solid'
import Link from 'next/link'
import BackButton from '../../../components/shared/BackButton'

export default function TokenPageLayout({
children,
Expand All @@ -9,14 +8,7 @@ export default function TokenPageLayout({
return (
<div className="px-6 lg:px-20 pb-12 pt-8 max-w-[1280px] mx-auto min-h-screen">
<div className="-mt-6">
<Link
className="text-th-fgd-4 flex items-center space-x-1"
href="/explore"
shallow
>
<ArrowLeftIcon className="h-5 w-5" />
<span>View all tokens</span>
</Link>
<BackButton />
<div className="mt-8">{children}</div>
</div>
</div>
Expand Down
19 changes: 19 additions & 0 deletions app/components/shared/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use client'

import { ArrowLeftIcon } from '@heroicons/react/20/solid'
import { useRouter } from 'next/navigation'

const BackButton = () => {
const router = useRouter()
return (
<button
className="text-th-fgd-4 flex items-center space-x-1 focus:outline-none md:hover:text-th-fgd-2"
onClick={() => router.back()}
>
<ArrowLeftIcon className="h-5 w-5" />
<span>Back</span>
</button>
)
}

export default BackButton
2 changes: 1 addition & 1 deletion tsconfig.tsbuildinfo

Large diffs are not rendered by default.

1 comment on commit 335beb5

@vercel
Copy link

@vercel vercel bot commented on 335beb5 Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.