-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
177 additions
and
144 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ArrowLeftIcon } from '@heroicons/react/20/solid' | ||
import Link from 'next/link' | ||
|
||
export default function TokenPageLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode | ||
}) { | ||
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> | ||
<div className="mt-8">{children}</div> | ||
</div> | ||
</div> | ||
) | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
'use client' | ||
|
||
import { useMemo, useState } from 'react' | ||
import { TokenPageWithData } from '../../../contentful/tokenPage' | ||
import { MangoTokenData } from '../../types/mango' | ||
import CategorySwitcher from './CategorySwitcher' | ||
import TableViewToggle from './TableViewToggle' | ||
import TokenTable from './TokenTable' | ||
import { TokenCategoryPage } from '../../../contentful/tokenCategoryPage' | ||
import RichTextDisplay from '../shared/RichTextDisplay' | ||
import DataDisclaimer from './DataDisclaimer' | ||
import { sortTokens } from './Explore' | ||
|
||
const SECTION_WRAPPER_CLASSES = 'border-t border-th-bkg-3 pt-6 mt-12' | ||
|
||
const Category = ({ | ||
categoryPageData, | ||
tokensForCategory, | ||
mangoTokensData, | ||
}: { | ||
categoryPageData: TokenCategoryPage | ||
tokensForCategory: TokenPageWithData[] | ||
mangoTokensData: MangoTokenData[] | ||
}) => { | ||
const [showTableView, setShowTableView] = useState(true) | ||
const { category, description } = categoryPageData | ||
|
||
const sortedTokens = useMemo(() => { | ||
return sortTokens(tokensForCategory) | ||
}, [tokensForCategory]) | ||
|
||
return ( | ||
<> | ||
<div className="mb-10 flex flex-col lg:flex-row lg:items-center lg:justify-between"> | ||
<h1 className="text-4xl mb-4 lg:mb-0">{`Explore ${category}`}</h1> | ||
<div className="flex space-x-2"> | ||
<CategorySwitcher tokens={tokensForCategory} /> | ||
<TableViewToggle | ||
showTableView={showTableView} | ||
setShowTableView={setShowTableView} | ||
/> | ||
</div> | ||
</div> | ||
<TokenTable | ||
tokens={sortedTokens} | ||
mangoTokensData={mangoTokensData} | ||
showTableView={showTableView} | ||
/> | ||
{description ? ( | ||
<div className={SECTION_WRAPPER_CLASSES}> | ||
<h2 className="mb-4 text-2xl">{`About ${category}`}</h2> | ||
<RichTextDisplay content={description} /> | ||
</div> | ||
) : null} | ||
<DataDisclaimer /> | ||
</> | ||
) | ||
} | ||
|
||
export default Category |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Squares2X2Icon, TableCellsIcon } from '@heroicons/react/20/solid' | ||
|
||
const TableViewToggle = ({ | ||
showTableView, | ||
setShowTableView, | ||
}: { | ||
showTableView: boolean | ||
setShowTableView: (show: boolean) => void | ||
}) => { | ||
return ( | ||
<div className="h-10 hidden lg:flex"> | ||
<button | ||
className={`flex w-10 items-center justify-center rounded-l-md border border-th-input-border border-r-0 focus:outline-none md:hover:bg-th-bkg-3 ${ | ||
showTableView ? 'bg-th-bkg-3 text-th-active' : 'text-th-fgd-3' | ||
}`} | ||
onClick={() => setShowTableView(!showTableView)} | ||
> | ||
<TableCellsIcon className="h-5 w-5" /> | ||
</button> | ||
<button | ||
className={`flex w-10 items-center justify-center rounded-r-md border border-th-input-border border-l-0 focus:outline-none md:hover:bg-th-bkg-3 ${ | ||
!showTableView ? 'bg-th-bkg-3 text-th-active' : 'text-th-fgd-3' | ||
}`} | ||
onClick={() => setShowTableView(!showTableView)} | ||
> | ||
<Squares2X2Icon className="h-5 w-5" /> | ||
</button> | ||
</div> | ||
) | ||
} | ||
|
||
export default TableViewToggle |
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
Oops, something went wrong.