Skip to content

Commit

Permalink
fix(nft-list): forward item onClick
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyyaaa committed Nov 23, 2023
1 parent eb7bba4 commit aa1c714
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 18 deletions.
85 changes: 68 additions & 17 deletions packages/react/stories/nft/NftProfileCardList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,96 @@ export const Primary: Story = {
list: [
{
imgSrc:
"https://res.cloudinary.com/stargaze/image/upload/w_700/m4sxagqpu98z76lcggyj.jpg",
"https://ipfs-gw.stargaze-apis.com/ipfs/bafybeibl5rrhfola4m2gxyzfji63fxyboeic36pjxjmrnmgablqhy3mnvy/3054.png",
name: "Bad Kid #9501",
highestOffer: "450",
listPrice: "373",
priceItems: [
{
label: "Highest offer",
value: "450",
},
{
label: "Listing price",
value: "373",
},
],
onClick: () => {
console.log("NFT #1");
},
},
{
imgSrc:
"https://res.cloudinary.com/stargaze/image/upload/w_700/wnfkydgxvp2vf0fqq277.jpg",
"https://ipfs-gw.stargaze-apis.com/ipfs/bafybeibl5rrhfola4m2gxyzfji63fxyboeic36pjxjmrnmgablqhy3mnvy/6.png",
name: "Bad Kid #9502",
highestOffer: "450",
listPrice: "373",
priceItems: [
{
label: "Highest offer",
value: "450",
},
{
label: "Listing price",
value: "373",
},
],
},
{
imgSrc:
"https://res.cloudinary.com/stargaze/image/upload/w_700/zkmiu7m7jelttu6ewrvu.jpg",
"https://ipfs-gw.stargaze-apis.com/ipfs/bafybeicf6q3az6bk4fyilhgk7ytgkctxjb3jsm4542cxtb6r4xsb35zoni/images/608.png",
name: "Bad Kid #9505",
highestOffer: "450",
listPrice: "373",
priceItems: [
{
label: "Highest offer",
value: "450",
},
{
label: "Listing price",
value: "373",
},
],
},
{
imgSrc:
"https://res.cloudinary.com/stargaze/image/upload/w_700/yisqceq5imrkgrzml02b.jpg",
"https://ipfs-gw.stargaze-apis.com/ipfs/bafybeicf6q3az6bk4fyilhgk7ytgkctxjb3jsm4542cxtb6r4xsb35zoni/images/444.png",
name: "Bad Kid #9506",
highestOffer: "450",
listPrice: "373",
priceItems: [
{
label: "Highest offer",
value: "450",
},
{
label: "Listing price",
value: "373",
},
],
},
{
imgSrc:
"https://res.cloudinary.com/stargaze/image/upload/w_700/benc6jvttlv9nbemyxch.jpg",
"https://ipfs-gw.stargaze-apis.com/ipfs/bafybeicf6q3az6bk4fyilhgk7ytgkctxjb3jsm4542cxtb6r4xsb35zoni/images/668.png",
name: "Bad Kid #9508",
highestOffer: "450",
listPrice: "373",
priceItems: [
{
label: "Highest offer",
value: "450",
},
{
label: "Listing price",
value: "373",
},
],
},
{
imgSrc:
"https://res.cloudinary.com/stargaze/image/upload/w_700/ndkbjpwtgys09w1xxwny.jpg",
name: "Bad Kid #9509",
highestOffer: "450",
listPrice: "373",
priceItems: [
{
label: "Highest offer",
value: "450",
},
{
label: "Listing price",
value: "373",
},
],
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function NftProfileCardList(props: NftProfileCardListProps) {
name={item?.name}
imgSrc={item?.imgSrc}
priceItems={item.priceItems}
onClick={(event) => item.onClick(event)}
thumbnailBehavior={props.thumbnailBehavior}
/>
</Box>
Expand Down
5 changes: 4 additions & 1 deletion src/ui/nft-profile-card/nft-profile-card.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export default function NftProfileCard(props: NftProfileCardProps) {
<Box
className={clsx(props.className)}
cursor={typeof props.onClick === "function" ? "pointer" : "default"}
attributes={{ ...props.attributes, onClick: () => props?.onClick?.() }}
attributes={{
...props.attributes,
onClick: (event) => props.onClick?.(event),
}}
>
<Stack direction="vertical" space="$4">
<Show when={props.thumbnailBehavior === "full"}>
Expand Down

0 comments on commit aa1c714

Please sign in to comment.