Commit 8c3ba8ba authored by aballerr's avatar aballerr Committed by GitHub

fix: Simplifying opacity hover and fixing a link (#5200)

* Simplifying Opacity hover state and fixing a link styling
parent c563dd5a
...@@ -29,3 +29,19 @@ export const ScrollBarStyles = css<{ $isHorizontalScroll?: boolean }>` ...@@ -29,3 +29,19 @@ export const ScrollBarStyles = css<{ $isHorizontalScroll?: boolean }>`
border-radius: 8px; border-radius: 8px;
} }
` `
export const OpacityHoverState = css`
&:hover {
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
`
import { OpacityHoverState } from 'components/Common'
import { Column, Row } from 'nft/components/Flex' import { Column, Row } from 'nft/components/Flex'
import { BagCloseIcon } from 'nft/components/icons' import { BagCloseIcon } from 'nft/components/icons'
import { roundAndPluralize } from 'nft/utils/roundAndPluralize' import { roundAndPluralize } from 'nft/utils/roundAndPluralize'
...@@ -33,19 +34,8 @@ const IconWrapper = styled.button` ...@@ -33,19 +34,8 @@ const IconWrapper = styled.button`
display: flex; display: flex;
padding: 2px; padding: 2px;
opacity: 1; opacity: 1;
&:hover {
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({ ${OpacityHoverState}
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
` `
interface BagHeaderProps { interface BagHeaderProps {
numberOfAssets: number numberOfAssets: number
......
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import clsx from 'clsx' import clsx from 'clsx'
import { OpacityHoverState } from 'components/Common'
import { MouseoverTooltip } from 'components/Tooltip' import { MouseoverTooltip } from 'components/Tooltip'
import { Box } from 'nft/components/Box' import { Box } from 'nft/components/Box'
import { Row } from 'nft/components/Flex' import { Row } from 'nft/components/Flex'
...@@ -93,12 +94,7 @@ const DetailsLinkContainer = styled.a` ...@@ -93,12 +94,7 @@ const DetailsLinkContainer = styled.a`
text-decoration: none; text-decoration: none;
color: ${({ theme }) => theme.textSecondary}; color: ${({ theme }) => theme.textSecondary};
:hover { ${OpacityHoverState}
opacity: ${({ theme }) => theme.opacity.hover};
}
:focus {
opacity: ${({ theme }) => theme.opacity.click};
}
` `
const SuspiciousIcon = styled(AlertTriangle)` const SuspiciousIcon = styled(AlertTriangle)`
......
...@@ -2,6 +2,7 @@ import { TraceEvent } from '@uniswap/analytics' ...@@ -2,6 +2,7 @@ import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events' import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import clsx from 'clsx' import clsx from 'clsx'
import { OpacityHoverState } from 'components/Common'
import { loadingAnimation } from 'components/Loader/styled' import { loadingAnimation } from 'components/Loader/styled'
import { parseEther } from 'ethers/lib/utils' import { parseEther } from 'ethers/lib/utils'
import { NftAssetTraitInput, NftMarketplace } from 'graphql/data/nft/__generated__/AssetQuery.graphql' import { NftAssetTraitInput, NftMarketplace } from 'graphql/data/nft/__generated__/AssetQuery.graphql'
...@@ -90,19 +91,7 @@ const EmptyCollectionWrapper = styled.div` ...@@ -90,19 +91,7 @@ const EmptyCollectionWrapper = styled.div`
` `
const ViewFullCollection = styled.span` const ViewFullCollection = styled.span`
&:hover { ${OpacityHoverState}
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
` `
const ClearAllButton = styled.button` const ClearAllButton = styled.button`
......
import { ScrollBarStyles } from 'components/Common' import { OpacityHoverState, ScrollBarStyles } from 'components/Common'
import { ActivityEventResponse } from 'nft/types' import { ActivityEventResponse } from 'nft/types'
import { shortenAddress } from 'nft/utils/address' import { shortenAddress } from 'nft/utils/address'
import { formatEthPrice } from 'nft/utils/currency' import { formatEthPrice } from 'nft/utils/currency'
...@@ -74,19 +74,7 @@ const Link = styled.a` ...@@ -74,19 +74,7 @@ const Link = styled.a`
color: ${({ theme }) => theme.textPrimary}; color: ${({ theme }) => theme.textPrimary};
text-decoration: none; text-decoration: none;
&:hover { ${OpacityHoverState}
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
` `
const ActivityContainer = styled.div` const ActivityContainer = styled.div`
......
import { ScrollBarStyles } from 'components/Common' import { OpacityHoverState, ScrollBarStyles } from 'components/Common'
import Resource from 'components/Tokens/TokenDetails/Resource' import Resource from 'components/Tokens/TokenDetails/Resource'
import { MouseoverTooltip } from 'components/Tooltip/index' import { MouseoverTooltip } from 'components/Tooltip/index'
import { Box } from 'nft/components/Box' import { Box } from 'nft/components/Box'
...@@ -19,7 +19,7 @@ import { useCallback, useMemo, useReducer, useState } from 'react' ...@@ -19,7 +19,7 @@ import { useCallback, useMemo, useReducer, useState } from 'react'
import InfiniteScroll from 'react-infinite-scroll-component' import InfiniteScroll from 'react-infinite-scroll-component'
import { useInfiniteQuery, useQuery } from 'react-query' import { useInfiniteQuery, useQuery } from 'react-query'
import { Link as RouterLink } from 'react-router-dom' import { Link as RouterLink } from 'react-router-dom'
import styled, { css } from 'styled-components/macro' import styled from 'styled-components/macro'
import AssetActivity from './AssetActivity' import AssetActivity from './AssetActivity'
import * as styles from './AssetDetails.css' import * as styles from './AssetDetails.css'
...@@ -27,22 +27,6 @@ import DetailsContainer from './DetailsContainer' ...@@ -27,22 +27,6 @@ import DetailsContainer from './DetailsContainer'
import InfoContainer from './InfoContainer' import InfoContainer from './InfoContainer'
import TraitsContainer from './TraitsContainer' import TraitsContainer from './TraitsContainer'
const OpacityTransition = css`
&:hover {
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
`
const CollectionHeader = styled.span` const CollectionHeader = styled.span`
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -51,7 +35,7 @@ const CollectionHeader = styled.span` ...@@ -51,7 +35,7 @@ const CollectionHeader = styled.span`
color: ${({ theme }) => theme.textPrimary}; color: ${({ theme }) => theme.textPrimary};
margin-top: 28px; margin-top: 28px;
text-decoration: none; text-decoration: none;
${OpacityTransition}; ${OpacityHoverState};
` `
const AssetPriceDetailsContainer = styled.div` const AssetPriceDetailsContainer = styled.div`
...@@ -89,7 +73,7 @@ const AddressTextLink = styled.a` ...@@ -89,7 +73,7 @@ const AddressTextLink = styled.a`
text-decoration: none; text-decoration: none;
max-width: 100%; max-width: 100%;
word-wrap: break-word; word-wrap: break-word;
${OpacityTransition}; ${OpacityHoverState};
` `
const SocialsContainer = styled.div` const SocialsContainer = styled.div`
...@@ -131,7 +115,7 @@ const Link = styled(RouterLink)` ...@@ -131,7 +115,7 @@ const Link = styled(RouterLink)`
line-height: 16px; line-height: 16px;
margin-top: 12px; margin-top: 12px;
cursor: pointer; cursor: pointer;
${OpacityTransition}; ${OpacityHoverState};
` `
const DefaultLink = styled(RouterLink)` const DefaultLink = styled(RouterLink)`
...@@ -172,7 +156,7 @@ const FilterBox = styled.div<{ isActive?: boolean }>` ...@@ -172,7 +156,7 @@ const FilterBox = styled.div<{ isActive?: boolean }>`
cursor: pointer; cursor: pointer;
box-sizing: border-box; box-sizing: border-box;
border: ${({ isActive, theme }) => (isActive ? `1px solid ${theme.accentActive}` : undefined)}; border: ${({ isActive, theme }) => (isActive ? `1px solid ${theme.accentActive}` : undefined)};
${OpacityTransition}; ${OpacityHoverState};
` `
const ByText = styled.span` const ByText = styled.span`
......
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { OpacityHoverState } from 'components/Common'
import useCopyClipboard from 'hooks/useCopyClipboard' import useCopyClipboard from 'hooks/useCopyClipboard'
import { CancelListingIcon, MinusIcon, PlusIcon } from 'nft/components/icons' import { CancelListingIcon, MinusIcon, PlusIcon } from 'nft/components/icons'
import { useBag } from 'nft/hooks' import { useBag } from 'nft/hooks'
...@@ -139,19 +140,7 @@ const UploadLink = styled.a` ...@@ -139,19 +140,7 @@ const UploadLink = styled.a`
color: ${({ theme }) => theme.textSecondary}; color: ${({ theme }) => theme.textSecondary};
cursor: pointer; cursor: pointer;
&:hover { ${OpacityHoverState}
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
` `
const NotForSaleContainer = styled.div` const NotForSaleContainer = styled.div`
...@@ -177,19 +166,7 @@ const OwnerText = styled.a` ...@@ -177,19 +166,7 @@ const OwnerText = styled.a`
color: ${({ theme }) => theme.textSecondary}; color: ${({ theme }) => theme.textSecondary};
text-decoration: none; text-decoration: none;
&:hover { ${OpacityHoverState}
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
` `
const OwnerInformationContainer = styled.div` const OwnerInformationContainer = styled.div`
...@@ -257,6 +234,11 @@ export const OwnerContainer = ({ asset }: { asset: GenieAsset }) => { ...@@ -257,6 +234,11 @@ export const OwnerContainer = ({ asset }: { asset: GenieAsset }) => {
) )
} }
const StyledLink = styled(Link)`
text-decoration: none;
${OpacityHoverState}
`
export const NotForSale = ({ collectionName, collectionUrl }: { collectionName: string; collectionUrl: string }) => { export const NotForSale = ({ collectionName, collectionUrl }: { collectionName: string; collectionUrl: string }) => {
const theme = useTheme() const theme = useTheme()
...@@ -271,9 +253,9 @@ export const NotForSale = ({ collectionName, collectionUrl }: { collectionName: ...@@ -271,9 +253,9 @@ export const NotForSale = ({ collectionName, collectionUrl }: { collectionName:
<ThemedText.BodySecondary fontSize="14px" lineHeight="20px"> <ThemedText.BodySecondary fontSize="14px" lineHeight="20px">
Discover similar NFTs for sale in Discover similar NFTs for sale in
</ThemedText.BodySecondary> </ThemedText.BodySecondary>
<Link to={`/nfts/collection/${collectionUrl}`}> <StyledLink to={`/nfts/collection/${collectionUrl}`}>
<ThemedText.Link lineHeight="20px">{collectionName}</ThemedText.Link> <ThemedText.Link lineHeight="20px">{collectionName}</ThemedText.Link>
</Link> </StyledLink>
</DiscoveryContainer> </DiscoveryContainer>
</NotForSaleContainer> </NotForSaleContainer>
</BestPriceContainer> </BestPriceContainer>
......
import { OpacityHoverState } from 'components/Common'
import useCopyClipboard from 'hooks/useCopyClipboard' import useCopyClipboard from 'hooks/useCopyClipboard'
import { CollectionInfoForAsset, GenieAsset } from 'nft/types' import { CollectionInfoForAsset, GenieAsset } from 'nft/types'
import { putCommas } from 'nft/utils' import { putCommas } from 'nft/utils'
...@@ -39,38 +40,14 @@ const Center = styled.span` ...@@ -39,38 +40,14 @@ const Center = styled.span`
display: flex; display: flex;
gap: 8px; gap: 8px;
&:hover { ${OpacityHoverState}
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
` `
const CreatorLink = styled.a` const CreatorLink = styled.a`
color: ${({ theme }) => theme.textPrimary}; color: ${({ theme }) => theme.textPrimary};
text-decoration: none; text-decoration: none;
&:hover { ${OpacityHoverState}
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
` `
const CopyIcon = styled(Copy)` const CopyIcon = styled(Copy)`
......
import { OpacityHoverState } from 'components/Common'
import { GenieAsset, Trait } from 'nft/types' import { GenieAsset, Trait } from 'nft/types'
import qs from 'query-string' import qs from 'query-string'
import { useMemo } from 'react' import { useMemo } from 'react'
...@@ -26,19 +27,7 @@ const GridItemContainer = styled(Link)` ...@@ -26,19 +27,7 @@ const GridItemContainer = styled(Link)`
padding: 12px; padding: 12px;
text-decoration: none; text-decoration: none;
&:hover { ${OpacityHoverState}
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
min-width: 0; min-width: 0;
` `
......
import { OpacityHoverState } from 'components/Common'
import ms from 'ms.macro' import ms from 'ms.macro'
import { CollectionTableColumn, Denomination, TimePeriod, VolumeType } from 'nft/types' import { CollectionTableColumn, Denomination, TimePeriod, VolumeType } from 'nft/types'
import { fetchPrice } from 'nft/utils' import { fetchPrice } from 'nft/utils'
...@@ -60,13 +61,7 @@ const Selector = styled.div<{ active: boolean }>` ...@@ -60,13 +61,7 @@ const Selector = styled.div<{ active: boolean }>`
background: ${({ active, theme }) => (active ? theme.backgroundInteractive : 'none')}; background: ${({ active, theme }) => (active ? theme.backgroundInteractive : 'none')};
cursor: pointer; cursor: pointer;
:hover { ${OpacityHoverState}
opacity: ${({ theme }) => theme.opacity.hover};
}
:active {
opacity: ${({ theme }) => theme.opacity.click};
}
` `
const StyledSelectorText = styled(ThemedText.SubHeader)<{ active: boolean }>` const StyledSelectorText = styled(ThemedText.SubHeader)<{ active: boolean }>`
......
import { Trace } from '@uniswap/analytics' import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events' import { PageName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { OpacityHoverState } from 'components/Common'
import { useLoadAssetsQuery } from 'graphql/data/nft/Asset' import { useLoadAssetsQuery } from 'graphql/data/nft/Asset'
import { useCollectionQuery, useLoadCollectionQuery } from 'graphql/data/nft/Collection' import { useCollectionQuery, useLoadCollectionQuery } from 'graphql/data/nft/Collection'
import { MobileHoverBag } from 'nft/components/bag/MobileHoverBag' import { MobileHoverBag } from 'nft/components/bag/MobileHoverBag'
...@@ -49,19 +50,8 @@ const IconWrapper = styled.button` ...@@ -49,19 +50,8 @@ const IconWrapper = styled.button`
display: flex; display: flex;
padding: 2px 0px; padding: 2px 0px;
opacity: 1; opacity: 1;
&:hover {
opacity: ${({ theme }) => theme.opacity.hover};
}
&:active {
opacity: ${({ theme }) => theme.opacity.click};
}
transition: ${({ ${OpacityHoverState}
theme: {
transition: { duration, timing },
},
}) => `opacity ${duration.medium} ${timing.ease}`};
` `
const Collection = () => { const Collection = () => {
......
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