import { useCollections } from '@reservoir0x/reservoir-kit-ui' import { Text, Button, Box } from '../primitives' import { DropdownMenuItem, DropdownMenuContent, } from 'components/primitives/Dropdown' import * as DropdownMenu from '@radix-ui/react-dropdown-menu' import { FC } from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faChevronDown } from '@fortawesome/free-solid-svg-icons' export type CollectionsSortingOption = NonNullable< Exclude[0], false | undefined>['sortBy'] > const sortingOptions: CollectionsSortingOption[] = [ '1DayVolume', '7DayVolume', '30DayVolume', 'allTimeVolume', ] const nameForSortingOption = ( option: CollectionsSortingOption, compact: boolean ) => { switch (option) { case '1DayVolume': return compact ? '24h' : '24 hours' case '7DayVolume': return compact ? '7d' : '7 days' case '30DayVolume': return compact ? '30d' : '30 days' case 'allTimeVolume': return compact ? 'All' : 'All Time' } } type Props = { compact?: boolean option: CollectionsSortingOption onOptionSelected: (option: CollectionsSortingOption) => void } const CollectionsTimeDropdown: FC = ({ compact = false, option, onOptionSelected, }) => { return ( {sortingOptions.map((optionItem) => ( onOptionSelected(optionItem as CollectionsSortingOption) } > {nameForSortingOption(optionItem, false)} ))} ) } export default CollectionsTimeDropdown