Skip to content

Commit

Permalink
fix: use useToken form antd (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
yutingzhao1991 authored Jan 22, 2024
1 parent e4a2c74 commit 6cbe8b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/great-melons-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ant-design/web3': patch
---

fix: Use useToken from antd
7 changes: 4 additions & 3 deletions packages/web3/src/nft-card/NFTCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
type Web3ConfigProviderProps,
} from '@ant-design/web3-common';
import type { ImageProps } from 'antd';
import { Button, ConfigProvider, Divider, Image, Skeleton, Space } from 'antd';
import useToken from 'antd/es/theme/useToken';
import { Button, ConfigProvider, Divider, Image, Skeleton, Space, theme } from 'antd';
import classNames from 'classnames';

import { CryptoPrice, type CryptoPriceProps } from '../crypto-price';
Expand All @@ -22,6 +21,8 @@ import { useStyle } from './style';

const customizePrefixCls = 'ant-nft-card';

const { useToken } = theme;

interface NFTCardProps {
address?: string;
tokenId?: number | bigint;
Expand Down Expand Up @@ -83,7 +84,7 @@ const NFTCard: React.FC<NFTCardProps> = ({
...metadataProps
}) => {
const { liked, totalLikes = 0, onLikeChange } = likeConfig || {};
const [, token] = useToken();
const { token } = useToken();
const { metadata, loading } = useNFT(address, parseNumberToBigint(tokenId), getNFTMetadata);
const {
name = metadata.name,
Expand Down

0 comments on commit 6cbe8b8

Please sign in to comment.