mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-13 19:11:01 +00:00
Allow for Custom IdentityIcon override (#375)
This commit is contained in:
@@ -90,7 +90,7 @@ class BaseIcon extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
public render (): React.ReactNode {
|
public render (): React.ReactNode {
|
||||||
const { address } = this.state;
|
const { address } = this.state;
|
||||||
const wrapped = this.getWrapped(this.state);
|
const wrapped = this.getWrapped(this.state, this.props);
|
||||||
|
|
||||||
return !address
|
return !address
|
||||||
? wrapped
|
? wrapped
|
||||||
@@ -104,11 +104,11 @@ class BaseIcon extends React.PureComponent<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 { className = '', isAlternative, isHighlight, size = DEFAULT_SIZE, style, theme = settings.icon } = this.props;
|
||||||
const Component = !address
|
const Component = !address
|
||||||
? Empty
|
? Empty
|
||||||
: Components[theme === 'default' ? ICON_DEFAULT_HOST : theme] || Fallback;
|
: Custom || Components[theme === 'default' ? ICON_DEFAULT_HOST : theme] || Fallback;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper
|
<Wrapper
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export interface Props extends BaseProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IdentityProps extends BaseProps {
|
export interface IdentityProps extends BaseProps {
|
||||||
|
Custom?: React.ComponentType<Props>;
|
||||||
isAlternative?: boolean;
|
isAlternative?: boolean;
|
||||||
isHighlight?: boolean;
|
isHighlight?: boolean;
|
||||||
onCopy?: (value: string) => void;
|
onCopy?: (value: string) => void;
|
||||||
|
|||||||
Reference in New Issue
Block a user