Skip to content

Commit

Permalink
Update nfts drawer tab to match design
Browse files Browse the repository at this point in the history
  • Loading branch information
serjonya-trili committed Oct 7, 2023
1 parent 5212e5c commit cedbbc1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
7 changes: 1 addition & 6 deletions src/components/AccountDrawer/AssetsPanel/AssetsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ export const AssetsPanel: React.FC<{
</TabPanel>

<TabPanel data-testid="account-card-nfts-tab" height="100%" overflow="hidden">
<NFTsGrid
nftsByOwner={{ [account.address.pkh]: nfts }}
showName={true}
columns={3}
spacing={5}
/>
<NFTsGrid nftsByOwner={{ [account.address.pkh]: nfts }} columns={3} spacing={5} />
</TabPanel>

<TabPanel data-testid="account-card-tokens-tab">
Expand Down
30 changes: 19 additions & 11 deletions src/components/AccountDrawer/AssetsPanel/NFTsGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { AspectRatio, Heading, Image, SimpleGrid, SimpleGridProps } from "@chakra-ui/react";
import {
AspectRatio,
Card,
CardBody,
Heading,

Check warning on line 5 in src/components/AccountDrawer/AssetsPanel/NFTsGrid.tsx

View workflow job for this annotation

GitHub Actions / build

'Heading' is defined but never used

Check warning on line 5 in src/components/AccountDrawer/AssetsPanel/NFTsGrid.tsx

View workflow job for this annotation

GitHub Actions / build

'Heading' is defined but never used
Image,
SimpleGrid,
SimpleGridProps,
} from "@chakra-ui/react";
import { every } from "lodash";
import { FC } from "react";
import { Link } from "react-router-dom";
Expand All @@ -8,10 +16,11 @@ import { NFTBalance } from "../../../types/TokenBalance";
import { truncate } from "../../../utils/format";

Check warning on line 16 in src/components/AccountDrawer/AssetsPanel/NFTsGrid.tsx

View workflow job for this annotation

GitHub Actions / build

'truncate' is defined but never used

Check warning on line 16 in src/components/AccountDrawer/AssetsPanel/NFTsGrid.tsx

View workflow job for this annotation

GitHub Actions / build

'truncate' is defined but never used
import { getIPFSurl } from "../../../utils/token/nftUtils";
import { NoNFTs } from "../../NoItems";
import colors from "../../../style/colors";

export const NFTsGrid: FC<
{ nftsByOwner: Record<RawPkh, NFTBalance[] | undefined>; showName?: boolean } & SimpleGridProps
> = ({ nftsByOwner, showName, ...rest }) => {
{ nftsByOwner: Record<RawPkh, NFTBalance[] | undefined> } & SimpleGridProps
> = ({ nftsByOwner, ...rest }) => {
const noNfts = every(nftsByOwner, nfts => !nfts || nfts.length === 0);
if (noNfts) {
return <NoNFTs small />;
Expand All @@ -25,14 +34,13 @@ export const NFTsGrid: FC<
const fallbackUrl = getIPFSurl(nft.displayUri);
return (
<Link to={`/nfts/${owner}/${fullId(nft)}`} key={`${owner}:${fullId(nft)}`}>
<AspectRatio width="100%" ratio={1}>
<Image width="100%" height={40} src={url} fallbackSrc={fallbackUrl} />
</AspectRatio>
{showName && nft.metadata.name && (
<Heading size="sm" mt={3}>
{truncate(nft.metadata.name, 12)}
</Heading>
)}
<Card bg={colors.gray[800]}>
<CardBody p="8px">
<AspectRatio width="100%" ratio={1}>
<Image width="100%" height={40} src={url} fallbackSrc={fallbackUrl} />
</AspectRatio>
</CardBody>
</Card>
</Link>
);
});
Expand Down

0 comments on commit cedbbc1

Please sign in to comment.