Skip to content

Commit

Permalink
Merge pull request #406 from reservoirprotocol/armando/grwth-3585-tre…
Browse files Browse the repository at this point in the history
…nding-mint-detail-page

Armando/grwth 3585 trending mint detail page
  • Loading branch information
r3lays authored Dec 5, 2023
2 parents 7994469 + 89b54eb commit f94a29f
Show file tree
Hide file tree
Showing 7 changed files with 690 additions and 21 deletions.
52 changes: 52 additions & 0 deletions components/common/MintTypeSelector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { ToggleGroupItem, ToggleGroupRoot } from 'components/primitives'
import { FC } from 'react'

export const MintTypeOptions = ['any', 'free', 'paid'] as const
export type MintTypeOption = (typeof MintTypeOptions)[number]

type Props = {
option: MintTypeOption
onOptionSelected: (option: MintTypeOption) => void
}

const MintTypeSelector: FC<Props> = ({ onOptionSelected, option }) => {
return (
<ToggleGroupRoot
type="single"
defaultChecked
defaultValue="any"
css={{
width: '100%',
}}
value={option}
onValueChange={(selectedOption) =>
selectedOption && onOptionSelected(selectedOption as MintTypeOption)
}
>
{MintTypeOptions.map((option) => (
<ToggleGroupItem
key={option}
value={option}
css={{
flexGrow: 1,
height: '44px',
textTransform: 'capitalize',
px: '$4',
py: '$2',
background: '$gray3',
'&:first-of-type': {
borderRadius: '8px 0 0 8px',
},
'&:last-of-type': {
borderRadius: '0 8px 8px 0',
},
}}
>
{option}
</ToggleGroupItem>
))}
</ToggleGroupRoot>
)
}

export default MintTypeSelector
95 changes: 95 additions & 0 deletions components/common/MintsPeriodDropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { faChevronDown } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import { useTrendingMints } from '@reservoir0x/reservoir-kit-ui'
import {
DropdownMenuContent,
DropdownMenuItem,
} from 'components/primitives/Dropdown'
import { FC } from 'react'
import { Box, Button, Text } from '../primitives'

export type MintsSortingOption = NonNullable<
Exclude<Parameters<typeof useTrendingMints>[0], false | undefined>['period']
>

const sortingOptions: MintsSortingOption[] = [
'5m',
'10m',
'30m',
'1h',
'6h',
'24h',
]

const nameForSortingOption = (option: MintsSortingOption, compact: boolean) => {
switch (option) {
case '24h':
return compact ? '24h' : '24 hours'
case '6h':
return compact ? '6h' : '6 hours'
case '1h':
return compact ? '1h' : '1 hour'
case '30m':
return compact ? '30m' : '30 minutes'
case '10m':
return compact ? '10m' : '10 minutes'
case '5m':
return compact ? '5m' : '5 minutes'
}
}

type Props = {
compact?: boolean
option: MintsSortingOption
onOptionSelected: (option: MintsSortingOption) => void
}

const MintsPeriodDropdown: FC<Props> = ({
compact = false,
option,
onOptionSelected,
}) => {
return (
<DropdownMenu.Root>
<DropdownMenu.Trigger asChild>
<Button
color="gray3"
css={{
px: '14px',
justifyContent: 'space-between',
'@md': {
width: '220px',
minWidth: 'max-content',
px: '$4',
},
}}
>
<Text style="body1">{nameForSortingOption(option, compact)}</Text>
<Box
css={{
color: '$gray10',
transition: 'transform',
'[data-state=open] &': { transform: 'rotate(180deg)' },
}}
>
<FontAwesomeIcon icon={faChevronDown} width={16} />
</Box>
</Button>
</DropdownMenu.Trigger>
<DropdownMenuContent css={{ width: '220px', mt: '$2', zIndex: 1000 }}>
{sortingOptions.map((optionItem) => (
<DropdownMenuItem
key={optionItem}
css={{ py: '$3' }}
onClick={() => onOptionSelected(optionItem as MintsSortingOption)}
>
{nameForSortingOption(optionItem, false)}
</DropdownMenuItem>
))}
</DropdownMenuContent>
</DropdownMenu.Root>
)
}

export default MintsPeriodDropdown
19 changes: 17 additions & 2 deletions components/navbar/HamburgerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const HamburgerMenu = () => {
Explore
</Text>
</Link>
<Link href="/ethereum/collection-rankings" legacyBehavior>
<Link href="/ethereum/collections/trending" legacyBehavior>
<Text
style="subtitle1"
css={{
Expand All @@ -144,10 +144,25 @@ const HamburgerMenu = () => {
pt: '24px',
}}
>
Trending
Trending Collections
</Text>
</Link>

<Link href="/ethereum/mints/trending" legacyBehavior>
<Text
style="subtitle1"
css={{
borderBottom: '1px solid $gray4',
cursor: 'pointer',
pb: '$4',
pt: '24px',
}}
>
Trending Mints
</Text>
</Link>


<Anchor
href="https://docs.reservoir.tools/docs"
target="_blank"
Expand Down
1 change: 1 addition & 0 deletions components/navbar/NavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const NavItem = forwardRef<
'&:hover': {
color: '$gray11',
},
...props.css,
}}
as="p"
style="subtitle1"
Expand Down
33 changes: 14 additions & 19 deletions components/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,41 +132,36 @@ const Navbar = () => {
<Link href={`/${routePrefix}`}>
<NavItem>Explore</NavItem>
</Link>
<Link href={`/${routePrefix}/collections/trending`}>
<NavItem>Trending</NavItem>
</Link>

{/* <HoverCard.Root openDelay={200}>
<HoverCard.Root openDelay={200}>
<HoverCard.Trigger>
<Link href={`/${routePrefix}/collection-rankings`}>
<NavItem
active={router.pathname.includes('collection-rankings')}
>
NFTs
</NavItem>
</Link>
<NavItem>Trending</NavItem>
</HoverCard.Trigger>
<HoverCard.Content sideOffset={24} align="start">
<Card css={{ p: 24, width: 240 }}>
<Card css={{ p: 24, width: 240, border: '1px solid $gray4' }}>
<Flex css={{ gap: '$4' }} direction="column">
<Link href={`/${routePrefix}/collection-rankings`}>
<Link href={`/${routePrefix}/collections/trending`}>
<NavItem
active={router.pathname.includes('collection-rankings')}
css={{
fontWeight: 'normal',
}}
>
Trending Collections
Collections
</NavItem>
</Link>
<Link href={`/${routePrefix}/collection-rankings`}>
<Link href={`/${routePrefix}/mints/trending`}>
<NavItem
active={router.pathname.includes('collection-rankings')}
css={{
fontWeight: 'normal',
}}
>
Trending Mints
Mints
</NavItem>
</Link>
</Flex>
</Card>
</HoverCard.Content>
</HoverCard.Root> */}
</HoverCard.Root>

{false && (
<Link href={`/${routePrefix}/collections/minting`}>
Expand Down
Loading

1 comment on commit f94a29f

@vercel
Copy link

@vercel vercel bot commented on f94a29f Dec 5, 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.