Commit 0fa1c5e6 authored by Jordan Frankfurt's avatar Jordan Frankfurt Committed by GitHub

fix: update clear all filters button styles for consistency (#5328)

* fix: update clear all filters button styles for consistency

* pr feedback
parent a7fd6098
...@@ -116,7 +116,7 @@ const ViewFullCollection = styled.span` ...@@ -116,7 +116,7 @@ const ViewFullCollection = styled.span`
${OpacityHoverState} ${OpacityHoverState}
` `
const ClearAllButton = styled.button` export const ClearAllButton = styled.button`
color: ${({ theme }) => theme.textTertiary}; color: ${({ theme }) => theme.textTertiary};
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;
...@@ -479,6 +479,12 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie ...@@ -479,6 +479,12 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
setSweepOpen(!sweepIsOpen) setSweepOpen(!sweepIsOpen)
}, [bagExpanded, hasErc1155s, isMobile, sweepIsOpen, toggleBag]) }, [bagExpanded, hasErc1155s, isMobile, sweepIsOpen, toggleBag])
const handleClearAllClick = useCallback(() => {
reset()
setPrevMinMax([0, 100])
scrollToTop()
}, [reset, setPrevMinMax])
return ( return (
<> <>
<AnimatedBox <AnimatedBox
...@@ -574,17 +580,9 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie ...@@ -574,17 +580,9 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
}} }}
/> />
)} )}
{!!traits.length || !!markets.length || minMaxPriceChipText ? ( {Boolean(traits.length || markets.length || minMaxPriceChipText) && (
<ClearAllButton <ClearAllButton onClick={handleClearAllClick}>Clear All</ClearAllButton>
onClick={() => { )}
reset()
setPrevMinMax([0, 100])
scrollToTop()
}}
>
Clear All
</ClearAllButton>
) : null}
</Row> </Row>
</AnimatedBox> </AnimatedBox>
<InfiniteScrollWrapper> <InfiniteScrollWrapper>
......
import { useNftBalanceQuery } from 'graphql/data/nft/NftBalance' import { useNftBalanceQuery } from 'graphql/data/nft/NftBalance'
import { AnimatedBox, Box } from 'nft/components/Box' import { AnimatedBox, Box } from 'nft/components/Box'
import { ClearAllButton } from 'nft/components/collection/CollectionNfts'
import { assetList } from 'nft/components/collection/CollectionNfts.css' import { assetList } from 'nft/components/collection/CollectionNfts.css'
import { FilterButton } from 'nft/components/collection/FilterButton' import { FilterButton } from 'nft/components/collection/FilterButton'
import { LoadingSparkle } from 'nft/components/common/Loading/LoadingSparkle' import { LoadingSparkle } from 'nft/components/common/Loading/LoadingSparkle'
...@@ -7,12 +8,18 @@ import { Center, Column, Row } from 'nft/components/Flex' ...@@ -7,12 +8,18 @@ import { Center, Column, Row } from 'nft/components/Flex'
import { CrossIcon } from 'nft/components/icons' import { CrossIcon } from 'nft/components/icons'
import { FilterSidebar } from 'nft/components/profile/view/FilterSidebar' import { FilterSidebar } from 'nft/components/profile/view/FilterSidebar'
import { subhead } from 'nft/css/common.css' import { subhead } from 'nft/css/common.css'
import { useBag, useFiltersExpanded, useIsMobile, useSellAsset, useWalletCollections } from 'nft/hooks' import {
import { useWalletBalance } from 'nft/hooks' useBag,
useFiltersExpanded,
useIsMobile,
useSellAsset,
useWalletBalance,
useWalletCollections,
} from 'nft/hooks'
import { ScreenBreakpointsPaddings } from 'nft/pages/collection/index.css' import { ScreenBreakpointsPaddings } from 'nft/pages/collection/index.css'
import { OSCollectionsFetcher } from 'nft/queries' import { OSCollectionsFetcher } from 'nft/queries'
import { WalletCollection } from 'nft/types' import { WalletCollection } from 'nft/types'
import { Dispatch, SetStateAction, Suspense, useEffect, useMemo, useState } from 'react' import { Dispatch, SetStateAction, Suspense, useCallback, useEffect, useMemo, useState } from 'react'
import InfiniteScroll from 'react-infinite-scroll-component' import InfiniteScroll from 'react-infinite-scroll-component'
import { useInfiniteQuery } from 'react-query' import { useInfiniteQuery } from 'react-query'
import { easings, useSpring } from 'react-spring' import { easings, useSpring } from 'react-spring'
...@@ -280,31 +287,18 @@ const CollectionFiltersRow = ({ ...@@ -280,31 +287,18 @@ const CollectionFiltersRow = ({
const getCollection = (collectionAddress: string) => { const getCollection = (collectionAddress: string) => {
return collections?.find((collection) => collection.address === collectionAddress) return collections?.find((collection) => collection.address === collectionAddress)
} }
const handleClearAllClick = useCallback(() => clearCollectionFilters(), [clearCollectionFilters])
return ( return (
<Row paddingY="18" gap="8" flexWrap="wrap"> <Row paddingY="18" gap="8" flexWrap="wrap">
{collectionFilters && {Boolean(collectionFilters?.length) &&
collectionFilters.map((collectionAddress, index) => ( collectionFilters.map((collectionAddress, index) => (
<CollectionFilterItem <CollectionFilterItem
collection={getCollection(collectionAddress)} collection={getCollection(collectionAddress)}
key={index} key={`CollectionFilterItem-${collectionAddress}-${index}`}
setCollectionFilters={setCollectionFilters} setCollectionFilters={setCollectionFilters}
/> />
))} ))}
{collectionFilters?.length ? ( {Boolean(collectionFilters?.length) && <ClearAllButton onClick={handleClearAllClick}>Clear all</ClearAllButton>}
<Box
as="button"
paddingLeft="8"
paddingRight="8"
color="genieBlue"
background="none"
fontSize="16"
border="none"
cursor="pointer"
onClick={() => clearCollectionFilters()}
>
Clear all
</Box>
) : null}
</Row> </Row>
) )
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment