Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixing color of buttons #5179

Merged
merged 13 commits into from Nov 14, 2022
2 changes: 1 addition & 1 deletion src/graphql/data/nft/NftBalance.ts
Expand Up @@ -170,7 +170,7 @@ export function useNftBalanceQuery(
collectionIsVerified: asset?.collection?.isVerified,
lastPrice: queryAsset.node.lastPrice?.value,
floorPrice: asset?.collection?.markets?.[0]?.floorPrice?.value,
creatorPercentage: queryAsset?.node?.listingFees?.[0]?.basisPoints ?? 0 / 10000,
basisPoints: queryAsset?.node?.listingFees?.[0]?.basisPoints ?? 0 / 10000,
listing_date: asset?.listings?.edges?.[0]?.node?.createdAt,
date_acquired: queryAsset.node.lastPrice?.timestamp,
sellOrders: asset?.listings?.edges.map((edge: any) => edge.node),
Expand Down
1 change: 1 addition & 0 deletions src/nft/components/bag/Bag.tsx
Expand Up @@ -315,6 +315,7 @@ const Bag = () => {
paddingY="10"
className={`${buttonTextMedium} ${commonButtonStyles}`}
backgroundColor="accentAction"
color="white"
textAlign="center"
onClick={() => {
isMobile && toggleBag()
Expand Down
2 changes: 1 addition & 1 deletion src/nft/components/bag/BagFooter.css.ts
Expand Up @@ -36,7 +36,7 @@ export const warningContainer = style([
export const payButton = style([
body,
sprinkles({
background: 'blue400',
background: 'accentAction',
border: 'none',
borderRadius: '12',
paddingY: '12',
Expand Down
4 changes: 0 additions & 4 deletions src/nft/components/bag/BagHeader.tsx
Expand Up @@ -13,10 +13,6 @@ const ClearButton = styled(ButtonText)`
font-size: 14px;
line-height: 16px;
transition: 150ms ease color;

:hover {
color: ${({ theme }) => theme.accentActive};
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we had a random blue hoverstate

`
const ControlRow = styled.div`
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion src/nft/components/bag/profile/utils.ts
Expand Up @@ -127,7 +127,7 @@ export const getTotalEthValue = (sellAssets: WalletAsset[]) => {
return (
total +
(maxListing.price ?? 0) -
(maxListing.price ?? 0) * (maxListing.marketplace.fee / 100 + asset.creatorPercentage)
(maxListing.price ?? 0) * (maxListing.marketplace.fee / 100 + asset.basisPoints)
)
}
return total
Expand Down
2 changes: 1 addition & 1 deletion src/nft/components/collection/FilterButton.tsx
Expand Up @@ -31,7 +31,7 @@ export const FilterButton = ({
width={isMobile ? '44' : 'auto'}
height="44"
whiteSpace="nowrap"
color="textPrimary"
color="white"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure we want to hardcode this tow hite?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a merge conflict, i changed this upstream

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2022-11-14 at 9 40 02 AM

This is what it looks like with textPrimary

>
<FilterIcon />
{!isMobile ? (
Expand Down
3 changes: 2 additions & 1 deletion src/nft/components/collection/Filters.css.ts
Expand Up @@ -8,7 +8,8 @@ export const container = style([
paddingTop: '4',
}),
{
width: '300px',
width: '308px',
paddingRight: '8px',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the shadow on the right slider overlaps the adjacent div, which creates a line to the right that looks strange(light mode only). This maintains the original dimensions while solving that issue

paddingBottom: '96px',
'@media': {
[`(max-width: ${breakpoints.sm - 1}px)`]: {
Expand Down
6 changes: 4 additions & 2 deletions src/nft/components/collection/PriceRange.tsx
Expand Up @@ -14,6 +14,7 @@ import { default as Slider } from 'rc-slider'
import { FocusEventHandler, FormEvent, useEffect, useState } from 'react'
import { useLocation } from 'react-router-dom'
import styled, { useTheme } from 'styled-components/macro'
import { colorsDark } from 'theme/colors'

import * as styles from './PriceRange.css'
import { TraitsHeader } from './TraitsHeader'
Expand Down Expand Up @@ -186,10 +187,11 @@ export const PriceRange = () => {
top: '3px',
width: '12px',
height: '20px',
backgroundColor: `${theme.textPrimary}`,
opacity: '1',
backgroundColor: `white`,
borderRadius: '4px',
border: 'none',
boxShadow: `${theme.shallowShadow.slice(0, -1)}`,
boxShadow: colorsDark.shallowShadow.slice(0, -1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we pulling this from theme anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theme has a different shadow color. I couldn't find this exact shadow defined anywhere but in darktheme.

}}
railStyle={{
top: '3px',
Expand Down
2 changes: 1 addition & 1 deletion src/nft/components/details/AssetPriceDetails.tsx
Expand Up @@ -374,7 +374,7 @@ export const AssetPriceDetails = ({ asset, collection }: AssetPriceDetailsProps)
}
}}
>
<SubHeader lineHeight={'20px'}>
<SubHeader color="white" lineHeight={'20px'}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be primaryColor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

primary isn't white in light theme

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aballerr could you sync with yushin on this? Apparently they defined a button-label in the design system that reflects what the text colors should be for light and dark.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2022-11-14 at 11 03 31 AM
Screen Shot 2022-11-14 at 11 03 38 AM

This is what buy now currently looks like and this is what buttons on our site look like. I'm not really sure what I need to sync on to be honest

<span>{assetInBag ? 'Remove' : 'Buy Now'}</span>
</SubHeader>
</BuyNowButton>
Expand Down
4 changes: 2 additions & 2 deletions src/nft/components/profile/list/ListPage.tsx
Expand Up @@ -595,7 +595,7 @@ const MarketplaceRow = ({

const marketplaceFee = selectedMarkets.length > 0 ? maxMarketFee(selectedMarkets) : 0
const price = showGlobalPrice ? globalPrice : listPrice
const feeInEth = price && (price * (asset.creatorPercentage * 100 + marketplaceFee)) / 100
const feeInEth = price && (price * (asset.basisPoints * 0.01 + marketplaceFee)) / 100
const userReceives = price && feeInEth && price - feeInEth
const profit = userReceives && asset.lastPrice && userReceives - asset.lastPrice
const profitPercent = profit && asset.lastPrice && Math.round(profit && (profit / asset.lastPrice) * 100)
Expand Down Expand Up @@ -714,7 +714,7 @@ const MarketplaceRow = ({
</Row>
<Row flex="1" display={{ sm: 'none', md: 'flex' }}>
<Box className={body} color="textSecondary" width="full" textAlign="right">
{(asset.creatorPercentage * 100).toFixed(1)}%
{(asset.basisPoints * 0.01).toFixed(1)}%
</Box>
</Row>
<Row style={{ flex: '1.5' }} display={{ sm: 'none', md: 'flex' }}>
Expand Down
5 changes: 4 additions & 1 deletion src/nft/components/profile/view/EmptyWalletContent.tsx
Expand Up @@ -23,14 +23,17 @@ const EmptyWalletText = styled.div`
const ExploreNFTsButton = styled.button`
background-color: ${({ theme }) => theme.accentAction};
padding: 10px 24px;
color: ${({ theme }) => theme.textPrimary};
color: ${({ theme }) => theme.white};
width: min-content;
border: none;
outline: none;
border-radius: 12px;
white-space: nowrap;
cursor: pointer;
margin-top: 20px;
font-weight: 500;
font-size: 16px;
line-height: 24px;
`

export const EmptyWalletContent = () => {
Expand Down
9 changes: 8 additions & 1 deletion src/nft/components/profile/view/ProfilePage.tsx
Expand Up @@ -44,12 +44,19 @@ const SellModeButton = styled.button<{ active: boolean }>`
gap: 8px;
cursor: pointer;
background-color: ${({ theme, active }) => (active ? theme.accentAction : theme.backgroundInteractive)};
color: ${({ theme }) => theme.textPrimary};
color: ${({ active, theme }) => (active ? 'white' : theme.textPrimary)};
border: none;
outline: none;
&:hover {
background-color: ${({ theme }) => theme.accentAction};
color: white;
}

transition: ${({
theme: {
transition: { duration, timing },
},
}) => `${duration.fast} all ${timing.ease}`};
`

const ProfilePageColumn = styled(Column)`
Expand Down
1 change: 0 additions & 1 deletion src/nft/css/common.css.ts
Expand Up @@ -41,7 +41,6 @@ export const commonButtonStyles = style([
sprinkles({
borderRadius: '12',
transition: '250',
boxShadow: { hover: 'elevation' },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common button styles has a boxShadow. Not a heavily used style, but we removed boxShadows from buttons

}),
{
border: 'none',
Expand Down
26 changes: 25 additions & 1 deletion src/nft/pages/collection/index.tsx
@@ -1,6 +1,11 @@
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import {
MAX_WIDTH_MEDIA_BREAKPOINT,
MOBILE_MEDIA_BREAKPOINT,
SMALL_MEDIA_BREAKPOINT,
} from 'components/Tokens/constants'
import { useLoadAssetsQuery } from 'graphql/data/nft/Asset'
import { useCollectionQuery, useLoadCollectionQuery } from 'graphql/data/nft/Collection'
import { MobileHoverBag } from 'nft/components/bag/MobileHoverBag'
Expand Down Expand Up @@ -34,8 +39,27 @@ const MobileFilterHeader = styled(Row)`
justify-content: space-between;
`

// Sticky navbar on light mode looks incorrect because the box shadows from assets overlap the the edges of the navbar.
// As a result it needs 14px padding on either side. These paddings are offset by 14px to account for this
const CollectionDisplaySection = styled(Row)`
${styles.ScreenBreakpointsPaddings}
@media screen and (min-width: ${MAX_WIDTH_MEDIA_BREAKPOINT}) {
padding-left: 34px;
padding-right: 34px;
}

@media screen and (max-width: ${MAX_WIDTH_MEDIA_BREAKPOINT}) {
padding-left: 26px;
padding-right: 26px;
}

@media screen and (max-width: ${SMALL_MEDIA_BREAKPOINT}) {
padding-left: 4px;
padding-right: 4px;
}

@media screen and (max-width: ${MOBILE_MEDIA_BREAKPOINT}) {
padding-left: 16px;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align-items: flex-start;
position: relative;
`
Expand Down
2 changes: 1 addition & 1 deletion src/nft/types/sell/sell.ts
Expand Up @@ -62,7 +62,7 @@ export interface WalletAsset {
collectionIsVerified: boolean
lastPrice: number
floorPrice: number
creatorPercentage: number
basisPoints: number
listing_date: string
date_acquired: string
sellOrders: SellOrder[]
Expand Down
6 changes: 3 additions & 3 deletions src/nft/utils/listNfts.ts
Expand Up @@ -55,7 +55,7 @@ const getConsiderationItems = (
creatorFee?: ConsiderationInputItem
} => {
const openSeaBasisPoints = OPENSEA_DEFAULT_FEE * INVERSE_BASIS_POINTS
const creatorFeeBasisPoints = asset.creatorPercentage * INVERSE_BASIS_POINTS
const creatorFeeBasisPoints = asset.basisPoints * INVERSE_BASIS_POINTS
const sellerBasisPoints = INVERSE_BASIS_POINTS - openSeaBasisPoints - creatorFeeBasisPoints

const openseaFee = price.mul(BigNumber.from(openSeaBasisPoints)).div(BigNumber.from(INVERSE_BASIS_POINTS)).toString()
Expand Down Expand Up @@ -187,7 +187,7 @@ export async function signListing(
endTime: BigNumber.from(asset.expirationTime),
// minimum ratio to be received by the user (per 10000)
minPercentageToAsk: BigNumber.from(10000)
.sub(BigNumber.from(200).add(BigNumber.from(asset.creatorPercentage * 10000)))
.sub(BigNumber.from(200).add(BigNumber.from(asset.basisPoints * 10000)))
.toNumber(),
// params (e.g., price, target account for private sale)
params: [],
Expand All @@ -214,7 +214,7 @@ export async function signListing(
price: parseEther(listingPrice.toString()).toString(),
startTime: currentTime,
endTime: asset.expirationTime,
minPercentageToAsk: 10000 - (200 + asset.creatorPercentage * 10000),
minPercentageToAsk: 10000 - (200 + asset.basisPoints * 10000),
params: [],
}
const res = await createLooksRareOrder(payload)
Expand Down