-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move NFT properties to tab (#27)
- Loading branch information
Showing
6 changed files
with
50 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { PaginationLite } from '@astraprotocol/astra-ui' | ||
import Row from 'components/Grid/Row' | ||
import CardInfo, { CardRowItem } from 'components/Card/CardInfo' | ||
import Empty from 'components/Typography/Empty' | ||
import usePaginationLite from 'hooks/usePaginationLite' | ||
import { useState, useCallback } from 'react' | ||
|
||
interface Props { | ||
tokenData: TokenNFTMetadata | ||
} | ||
|
||
const NftPropertiesTab = ({ tokenData }: Props) => { | ||
const _convertRawDataToCardData = useCallback((data: TokenNFTAttributes[]): CardRowItem[] => { | ||
if (!data) return [] | ||
let items: CardRowItem[] = [] | ||
for (let item of data) { | ||
if (item !== undefined && item !== null) | ||
items.push({ | ||
label: item.trait_type, | ||
type: 'text', | ||
contents: [{ value: item.value }] | ||
}) | ||
} | ||
|
||
return items | ||
}, []) | ||
|
||
return ( | ||
<CardInfo | ||
topElement={<span className="text text-xl padding-2xl">Properties</span>} | ||
items={_convertRawDataToCardData(tokenData.attributes)} | ||
classes={['margin-top-sm padding-top-md']} | ||
background={false} | ||
backgroundCardBlur={false} | ||
/> | ||
) | ||
} | ||
|
||
export default NftPropertiesTab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters