From fea7424a7da981bb0b3e47e3bd20a8dca7ff347d Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 30 Sep 2020 14:20:50 +0200 Subject: [PATCH] Allow for Custom IdentityIcon override (#375) --- packages/react-identicon/src/Identicon.tsx | 6 +++--- packages/react-identicon/src/types.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/react-identicon/src/Identicon.tsx b/packages/react-identicon/src/Identicon.tsx index 2e81a5a3..8d627af4 100644 --- a/packages/react-identicon/src/Identicon.tsx +++ b/packages/react-identicon/src/Identicon.tsx @@ -90,7 +90,7 @@ class BaseIcon extends React.PureComponent { public render (): React.ReactNode { const { address } = this.state; - const wrapped = this.getWrapped(this.state); + const wrapped = this.getWrapped(this.state, this.props); return !address ? wrapped @@ -104,11 +104,11 @@ class BaseIcon extends React.PureComponent { ); } - private getWrapped ({ address, publicKey }: State): React.ReactNode { + private getWrapped ({ address, publicKey }: State, { Custom }: Props): React.ReactNode { const { className = '', isAlternative, isHighlight, size = DEFAULT_SIZE, style, theme = settings.icon } = this.props; const Component = !address ? Empty - : Components[theme === 'default' ? ICON_DEFAULT_HOST : theme] || Fallback; + : Custom || Components[theme === 'default' ? ICON_DEFAULT_HOST : theme] || Fallback; return ( ; isAlternative?: boolean; isHighlight?: boolean; onCopy?: (value: string) => void;