@zoralabs/nft-components
Advanced tools
Comparing version 0.1.18 to 0.1.19
@@ -5,5 +5,4 @@ /// <reference types="react" /> | ||
showChars?: number; | ||
useEns?: boolean; | ||
}; | ||
export declare const AddressView: ({ address, showChars, useEns, }: AddressViewProps) => JSX.Element; | ||
export declare const AddressView: ({ address, showChars }: AddressViewProps) => JSX.Element; | ||
export {}; |
@@ -8,12 +8,13 @@ "use strict"; | ||
const PREFIX_ADDRESS = "0x"; | ||
const AddressView = ({ address, showChars = 6, useEns = true, }) => { | ||
const AddressView = ({ address, showChars = 6 }) => { | ||
var _a, _b; | ||
const { getStyles } = useMediaContext_1.useMediaContext(); | ||
const { getStyles, style } = useMediaContext_1.useMediaContext(); | ||
const { theme } = style; | ||
// @ts-ignore (address can be undefined but not typed correctly for now) | ||
const ens = nft_hooks_1.useENSAddress(useEns ? address : undefined); | ||
const username = nft_hooks_1.useZoraUsername(!useEns || ens.error ? address : undefined); | ||
const ens = nft_hooks_1.useENSAddress(theme.useEnsResolution ? address : undefined); | ||
const username = nft_hooks_1.useZoraUsername(theme.useZoraUsernameResolution || ens.error ? address : undefined); | ||
const addressFirst = address.slice(0, showChars + PREFIX_ADDRESS.length); | ||
const addressLast = address.slice(address.length - showChars); | ||
if ((_a = ens.data) === null || _a === void 0 ? void 0 : _a.name) { | ||
const zoraLink = ens.data.name.endsWith('.ens') ? ens.data.name : address; | ||
const zoraLink = ens.data.name.endsWith(".ens") ? ens.data.name : address; | ||
return (jsx_runtime_1.jsx("a", Object.assign({}, getStyles("addressLink"), { href: `https://zora.co/${zoraLink}`, target: "_blank", rel: "noreferrer" }, { children: jsx_runtime_1.jsx("span", { children: ens.data.name }, void 0) }), void 0)); | ||
@@ -25,7 +26,9 @@ } | ||
// Username loading | ||
if (!username.error && !username.username) { | ||
if (theme.useZoraUsernameResolution && | ||
!username.error && | ||
!username.username) { | ||
return jsx_runtime_1.jsx("span", { children: "..." }, void 0); | ||
} | ||
// Ens loading | ||
if (useEns && !ens.error && !ens.data) { | ||
if (theme.useEnsResolution && !ens.error && !ens.data) { | ||
return jsx_runtime_1.jsx("span", { children: "..." }, void 0); | ||
@@ -32,0 +35,0 @@ } |
@@ -14,2 +14,4 @@ import { ThemeOptionsType } from "./theme"; | ||
showCreator: boolean; | ||
useEnsResolution: boolean; | ||
useZoraUsernameResolution: boolean; | ||
showOwner: boolean; | ||
@@ -16,0 +18,0 @@ showTxnLinks: boolean; |
@@ -22,2 +22,12 @@ export declare const ThemeOptions: { | ||
/** | ||
* Flag if ens resolution should be automatically used | ||
* @default true | ||
*/ | ||
useEnsResolution: boolean; | ||
/** | ||
* Flag if zora username resolution should be automatically used | ||
* @default true | ||
*/ | ||
useZoraUsernameResolution: boolean; | ||
/** | ||
* Flag if showing the nft owner on full view | ||
@@ -24,0 +34,0 @@ * should be enabled |
@@ -25,2 +25,12 @@ "use strict"; | ||
/** | ||
* Flag if ens resolution should be automatically used | ||
* @default true | ||
*/ | ||
useEnsResolution: true, | ||
/** | ||
* Flag if zora username resolution should be automatically used | ||
* @default true | ||
*/ | ||
useZoraUsernameResolution: true, | ||
/** | ||
* Flag if showing the nft owner on full view | ||
@@ -27,0 +37,0 @@ * should be enabled |
{ | ||
"name": "@zoralabs/nft-components", | ||
"version": "0.1.18", | ||
"version": "0.1.19", | ||
"description": "NFT Media Rendering Components", | ||
@@ -18,3 +18,3 @@ "typings": "dist/index.d.ts", | ||
"@types/react": "^17.0.5", | ||
"@zoralabs/nft-hooks": "^0.7.1", | ||
"@zoralabs/nft-hooks": "^0.7.2", | ||
"merge-anything": "^4.0.1", | ||
@@ -21,0 +21,0 @@ "react": "^17.0.2", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
272769
5440
Updated@zoralabs/nft-hooks@^0.7.2