feat: revised profile card designs (#4901)

* add default style

* update select button styles

* add styles for listed cards

* update index for profile skeleton

Co-authored-by: Charles Bachmeier <charlie@genie.xyz>
This commit is contained in:
Charles Bachmeier 2022-10-13 10:13:35 -07:00 committed by GitHub
parent a5c5567936
commit c0db592ab5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 49 deletions

@ -75,7 +75,11 @@ export const ProfilePageLoadingSkeleton = () => {
<FilterButtonSkeleton /> <FilterButtonSkeleton />
<SellButtonSkeleton /> <SellButtonSkeleton />
</FilterBarSkeletonWrapper> </FilterBarSkeletonWrapper>
<div className={assetList}>{new Array(25).fill(<ProfileAssetCardSkeleton />)}</div> <div className={assetList}>
{new Array(25).map((_, index) => (
<ProfileAssetCardSkeleton key={index} />
))}
</div>
</SkeletonPageWrapper> </SkeletonPageWrapper>
) )
} }

@ -1,7 +1,7 @@
import { Box } from 'nft/components/Box' import { Box } from 'nft/components/Box'
import { Column } from 'nft/components/Flex' import { Column, Row } from 'nft/components/Flex'
import { VerifiedIcon } from 'nft/components/icons' import { VerifiedIcon } from 'nft/components/icons'
import { subheadSmall } from 'nft/css/common.css' import { bodySmall, buttonTextSmall, subhead } from 'nft/css/common.css'
import { useBag, useIsMobile, useSellAsset } from 'nft/hooks' import { useBag, useIsMobile, useSellAsset } from 'nft/hooks'
import { DetailsOrigin, WalletAsset } from 'nft/types' import { DetailsOrigin, WalletAsset } from 'nft/types'
import { formatEth, getAssetHref } from 'nft/utils' import { formatEth, getAssetHref } from 'nft/utils'
@ -41,11 +41,19 @@ export const WalletAssetDisplay = ({ asset, isSellMode }: { asset: WalletAsset;
toggleCart() toggleCart()
} }
const uniqueSellOrdersMarketplaces = useMemo(
() => [...new Set(asset.sellOrders.map((order) => order.marketplace))],
[asset.sellOrders]
)
return ( return (
<Link to={getAssetHref(asset, DetailsOrigin.PROFILE)} style={{ textDecoration: 'none' }}> <Link to={getAssetHref(asset, DetailsOrigin.PROFILE)} style={{ textDecoration: 'none' }}>
<Column <Column
color={'textPrimary'} borderBottomLeftRadius="20"
className={subheadSmall} borderBottomRightRadius="20"
paddingBottom="20"
transition="250"
backgroundColor={boxHovered ? 'backgroundOutline' : 'backgroundSurface'}
onMouseEnter={toggleBoxHovered} onMouseEnter={toggleBoxHovered}
onMouseLeave={toggleBoxHovered} onMouseLeave={toggleBoxHovered}
> >
@ -58,48 +66,47 @@ export const WalletAssetDisplay = ({ asset, isSellMode }: { asset: WalletAsset;
src={asset.image_url ?? '/nft/svgs/image-placeholder.svg'} src={asset.image_url ?? '/nft/svgs/image-placeholder.svg'}
style={{ aspectRatio: '1' }} style={{ aspectRatio: '1' }}
/> />
<Column <Column paddingTop="12" paddingX="12">
position="relative" <Row>
borderBottomLeftRadius="20" <Column flex="2" gap="4" whiteSpace="nowrap" style={{ maxWidth: '67%' }}>
borderBottomRightRadius="20" <Box className={subhead} color="textPrimary" overflow="hidden" textOverflow="ellipsis">
transition="250" {asset.name ? asset.name : `#${asset.tokenId}`}
backgroundColor={boxHovered ? 'backgroundOutline' : 'backgroundSurface'}
paddingY="12"
paddingX="12"
>
<Box className={subheadSmall} overflow="hidden" textOverflow="ellipsis" marginTop="4" lineHeight="20">
{asset.name ? asset.name : `#${asset.tokenId}`}
</Box>
<Box fontSize="12" marginTop="4" lineHeight="16" overflow="hidden" textOverflow="ellipsis">
{asset.collection?.name}
{asset.collectionIsVerified ? <VerifiedIcon className={styles.verifiedBadge} /> : null}
</Box>
<Box as="span" fontSize="12" lineHeight="16" color="textSecondary" marginTop="8">
Last:&nbsp;
{asset.lastPrice ? (
<>
{formatEth(asset.lastPrice)}
&nbsp;ETH
</>
) : (
<Box as="span" marginLeft="6">
&mdash;
</Box> </Box>
)} <Box className={bodySmall} color="textSecondary" overflow="hidden" textOverflow="ellipsis">
</Box> {asset.collection?.name}
<Box as="span" fontSize="12" lineHeight="16" color="textSecondary" marginTop="4"> {asset.collectionIsVerified ? <VerifiedIcon className={styles.verifiedBadge} /> : null}
Floor:&nbsp;
{asset.floorPrice ? (
<>
{formatEth(asset.floorPrice)}
&nbsp;ETH
</>
) : (
<Box as="span" marginLeft="8">
&mdash;
</Box> </Box>
</Column>
{asset.sellOrders.length > 0 && (
<Column gap="6" flex="1" justifyContent="flex-end" whiteSpace="nowrap" style={{ maxWidth: '33%' }}>
<>
<Row className={subhead} color="textPrimary">
<Box width="full" textAlign="right" overflow="hidden" textOverflow="ellipsis">
{formatEth(asset.floor_sell_order_price)}
</Box>
&nbsp;ETH
</Row>
<Row justifyContent="flex-end">
{uniqueSellOrdersMarketplaces.map((market, index) => {
return (
<Box
as="img"
key={index}
alt={market}
width="16"
height="16"
borderRadius="4"
marginLeft="4"
objectFit="cover"
src={`/nft/svgs/marketplaces/${market}.svg`}
/>
)
})}
</Row>
</>
</Column>
)} )}
</Box> </Row>
{isSellMode && ( {isSellMode && (
<Box <Box
marginTop="12" marginTop="12"
@ -108,9 +115,17 @@ export const WalletAssetDisplay = ({ asset, isSellMode }: { asset: WalletAsset;
borderRadius="12" borderRadius="12"
paddingY="8" paddingY="8"
transition="250" transition="250"
color={buttonHovered ? 'textPrimary' : isSelected ? 'red400' : 'genieBlue'} color={buttonHovered || isSelected ? 'textPrimary' : 'accentAction'}
backgroundColor={buttonHovered ? (isSelected ? 'red400' : 'genieBlue') : 'backgroundSurface'} backgroundColor={
className={subheadSmall} buttonHovered
? isSelected
? 'accentFailure'
: 'accentAction'
: isSelected
? 'backgroundInteractive'
: 'accentActionSoft'
}
className={buttonTextSmall}
onMouseEnter={toggleButtonHovered} onMouseEnter={toggleButtonHovered}
onMouseLeave={toggleButtonHovered} onMouseLeave={toggleButtonHovered}
onClick={(e) => { onClick={(e) => {

@ -14,7 +14,7 @@ import { useToggleWalletModal } from 'state/application/hooks'
import * as styles from './sell.css' import * as styles from './sell.css'
const SHOPPING_BAG_WIDTH = 324 const SHOPPING_BAG_WIDTH = 360
const Profile = () => { const Profile = () => {
const sellPageState = useProfilePageState((state) => state.state) const sellPageState = useProfilePageState((state) => state.state)

@ -5,7 +5,7 @@ export const darkTheme: Theme = {
accentFailure: vars.color.red300, accentFailure: vars.color.red300,
accentFailureSoft: 'rgba(253, 118, 107, 0.12)', accentFailureSoft: 'rgba(253, 118, 107, 0.12)',
accentAction: vars.color.blue400, accentAction: vars.color.blue400,
accentActionSoft: '#000000E5', accentActionSoft: 'rgba(76, 130, 251, 0.24)',
explicitWhite: '#FFFFFF', explicitWhite: '#FFFFFF',
green: vars.color.green200, green: vars.color.green200,