diff --git a/src/nft/components/profile/view/FilterSidebar.tsx b/src/nft/components/profile/view/FilterSidebar.tsx index 9d6426e15b..e7813f1514 100644 --- a/src/nft/components/profile/view/FilterSidebar.tsx +++ b/src/nft/components/profile/view/FilterSidebar.tsx @@ -9,8 +9,9 @@ import { themeVars } from 'nft/css/sprinkles.css' import { useFiltersExpanded, useIsMobile, useWalletCollections } from 'nft/hooks' import { WalletCollection } from 'nft/types' import { Dispatch, FormEvent, SetStateAction, useCallback, useEffect, useReducer, useState } from 'react' -import { useSpring } from 'react-spring' +import { easings, useSpring } from 'react-spring' import styled from 'styled-components/macro' +import { TRANSITION_DURATIONS } from 'theme/styles' import * as styles from './ProfilePage.css' @@ -22,7 +23,6 @@ const ItemsContainer = styled.div` export const FilterSidebar = () => { const collectionFilters = useWalletCollections((state) => state.collectionFilters) const setCollectionFilters = useWalletCollections((state) => state.setCollectionFilters) - const walletCollections = useWalletCollections((state) => state.walletCollections) const [isFiltersExpanded, setFiltersExpanded] = useFiltersExpanded() @@ -30,6 +30,10 @@ export const FilterSidebar = () => { const { sidebarX } = useSpring({ sidebarX: isFiltersExpanded ? 0 : -360, + config: { + duration: TRANSITION_DURATIONS.medium, + easing: easings.easeOutSine, + }, }) return ( // @ts-ignore diff --git a/src/nft/components/profile/view/ProfilePage.tsx b/src/nft/components/profile/view/ProfilePage.tsx index aa0571a227..7d04a3a951 100644 --- a/src/nft/components/profile/view/ProfilePage.tsx +++ b/src/nft/components/profile/view/ProfilePage.tsx @@ -21,7 +21,7 @@ import { WalletCollection } from 'nft/types' import { Dispatch, SetStateAction, useEffect, useState } from 'react' import InfiniteScroll from 'react-infinite-scroll-component' import { useQuery } from 'react-query' -import { useSpring } from 'react-spring' +import { easings, useSpring } from 'react-spring' import styled from 'styled-components/macro' import shallow from 'zustand/shallow' @@ -66,6 +66,7 @@ export const ProfilePage = () => { shallow ) const sellAssets = useSellAsset((state) => state.sellAssets) + const isBagExpanded = useBag((state) => state.bagExpanded) const toggleBag = useBag((state) => state.toggleBag) const [isFiltersExpanded, setFiltersExpanded] = useFiltersExpanded() const isMobile = useIsMobile() @@ -91,6 +92,10 @@ export const ProfilePage = () => { const { gridX } = useSpring({ gridX: isFiltersExpanded ? FILTER_SIDEBAR_WIDTH : -PADDING, + config: { + duration: 250, + easing: easings.easeOutSine, + }, }) return ( @@ -107,6 +112,7 @@ export const ProfilePage = () => { diff --git a/src/nft/pages/collection/index.tsx b/src/nft/pages/collection/index.tsx index 68b2fa5466..7c7fa80d2d 100644 --- a/src/nft/pages/collection/index.tsx +++ b/src/nft/pages/collection/index.tsx @@ -24,6 +24,7 @@ import { useLocation, useNavigate, useParams } from 'react-router-dom' import { easings, useSpring } from 'react-spring' import styled from 'styled-components/macro' import { ThemedText } from 'theme' +import { TRANSITION_DURATIONS } from 'theme/styles' const FILTER_WIDTH = 332 const BAG_WIDTH = 324 @@ -100,11 +101,11 @@ const Collection = () => { ? isBagExpanded ? BAG_WIDTH + FILTER_WIDTH : FILTER_WIDTH - : isBagExpanded + : isBagExpanded && !isMobile ? BAG_WIDTH : 0, config: { - duration: 250, + duration: TRANSITION_DURATIONS.medium, easing: easings.easeOutSine, }, }) @@ -188,7 +189,7 @@ const Collection = () => { {/* @ts-ignore: https://github.com/microsoft/TypeScript/issues/34933 */} `translate(${x as number}px)`), width: gridWidthOffset.to((x) => `calc(100% - ${x as number}px)`), diff --git a/src/theme/styles.ts b/src/theme/styles.ts index 7f3aa5fbe1..eac90ce989 100644 --- a/src/theme/styles.ts +++ b/src/theme/styles.ts @@ -10,11 +10,17 @@ export const flexRowNoWrap = css` flex-flow: row nowrap; ` +export enum TRANSITION_DURATIONS { + slow = 500, + medium = 250, + fast = 125, +} + const transitions = { duration: { - slow: '500ms', - medium: '250ms', - fast: '125ms', + slow: `${TRANSITION_DURATIONS.slow}ms`, + medium: `${TRANSITION_DURATIONS.medium}ms`, + fast: `${TRANSITION_DURATIONS.fast}ms`, }, timing: { ease: 'ease',