Skip to content

Commit

Permalink
Merge pull request #75 from nervina-labs/feat/link-external-props
Browse files Browse the repository at this point in the history
feat: link external as a prop to some components
  • Loading branch information
yuche authored Oct 24, 2021
2 parents 72721b9 + d61a6fd commit d17f97f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion libs/mibao-ui/src/lib/issuer/issuer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface IssuerProps extends AvatarProps {
onClick?: React.MouseEventHandler<HTMLDivElement>
disableCopy?: boolean
displayId?: string
isLinkExternal?: boolean
}

export const Issuer: React.FC<IssuerProps> = ({
Expand All @@ -34,9 +35,10 @@ export const Issuer: React.FC<IssuerProps> = ({
disableCopy = false,
size = '60px',
resizeScale = 150,
isLinkExternal = true,
...avatarProps
}) => {
const anchorProps = href && !isBanned ? { as: Link, href, isExternal: true } : undefined
const anchorProps = href && !isBanned ? { as: Link, href, isExternal: isLinkExternal } : undefined
const isOneline = id == null && verifiedTitle == null
return (
<Flex
Expand Down
4 changes: 3 additions & 1 deletion libs/mibao-ui/src/lib/nft-card/nft-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface NFTCardProps extends FlexProps {
likeProps?: LikeProps
imageProps?: NftImageProps
titleProps?: NFTTitleProps
isLinkExternal?: boolean
}

export const NFTCard: React.FC<NFTCardProps> = ({
Expand All @@ -50,10 +51,11 @@ export const NFTCard: React.FC<NFTCardProps> = ({
issuerProps,
limitProps,
titleProps,
isLinkExternal = true,
...rest
}) => {
const isBanned = !!isIssuerBanned || !!isNFTBanned
const anchorProps = href && !isBanned ? { as: Link, href, isExternal: true } : undefined
const anchorProps = href && !isBanned ? { as: Link, href, isExternal: isLinkExternal } : undefined

const info = useMemo(() => {
if (likeProps && issuerProps && limitProps) {
Expand Down
4 changes: 3 additions & 1 deletion libs/mibao-ui/src/lib/nft-list-item/nft-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface NFTListItemProps extends FlexProps {
title?: string
bannedText?: string
href?: string
isLinkExternal?: boolean
srcQueryParams?: { tid: number, locale: string }
src?: string
locale?: string
Expand All @@ -44,10 +45,11 @@ export const NFTListItem: React.FC<NFTListItemProps> = ({
issuerProps,
limitProps,
titleProps,
isLinkExternal = true,
...rest
}) => {
const isBanned = !!isIssuerBanned || !!isNFTBanned
const anchorProps = href && !isBanned ? { as: Link, href, isExternal: true } : undefined
const anchorProps = href && !isBanned ? { as: Link, href, isExternal: isLinkExternal } : undefined

return (
<Flex
Expand Down

1 comment on commit d17f97f

@vercel
Copy link

@vercel vercel bot commented on d17f97f Oct 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.