Fixes the styling for custom-wrapped components

This commit is contained in:
Oleg Silkin 2019-12-03 20:30:29 -05:00 committed by Sean Yesmunt
parent 1173171084
commit fb868a5810

View file

@ -65,18 +65,22 @@ class UriIndicator extends React.PureComponent<Props> {
return inner; return inner;
} }
if (children) {
return <Button navigate={channelLink}>{children}</Button>;
} else {
const Wrapper = addTooltip const Wrapper = addTooltip
? ({ children }) => ( ? ({ children }) => (
<Tooltip label={<ClaimPreview uri={channelLink} type="tooltip" placeholder={false} />}>{children}</Tooltip> <Tooltip label={<ClaimPreview uri={channelLink} type="tooltip" placeholder={false} />}>
{children}
</Tooltip>
) )
: 'span'; : 'span';
/* to wrap the UriIndicator element around other DOM nodes as a button */
const content = children ? children : (<Wrapper>{inner}</Wrapper>);
return ( return (
<Button className="button--uri-indicator" navigate={channelLink}> <Button className="button--uri-indicator" navigate={channelLink}>
{content} <Wrapper>{inner}</Wrapper>
</Button> </Button>
); );
}
} else { } else {
return null; return null;
} }