Make Discover page channel names into links

This commit is contained in:
Travis Eden 2017-12-14 16:12:04 -05:00
parent a0314c21ec
commit ca527cc4c0
3 changed files with 23 additions and 16 deletions

View file

@ -94,20 +94,22 @@ class FileCard extends React.PureComponent {
<TruncatedText lines={1}>{title}</TruncatedText>
</div>
<div className="card__subtitle">
<span className="card__indicators">
<span className="card__indicators card--file-subtitle">
<FilePrice uri={uri} />{" "}
{isRewardContent && <Icon icon={icons.FEATURED} />}{" "}
{fileInfo && <Icon icon={icons.LOCAL} />}
</span>
<UriIndicator uri={uri} smallCard />
<span className="card--file-subtitle">
<UriIndicator uri={uri} link={true} span={true} smallCard />
</span>
</div>
</div>
</Link>
{/* Test for nizuka's design: should we remove description?
<div className="card__content card__subtext card__subtext--two-lines">
<TruncatedMarkdown lines={2}>{description}</TruncatedMarkdown>
</div>
*/}
</Link>
</div>
{obscureNsfw && this.state.hovered && <NsfwOverlay />}
</section>

View file

@ -16,6 +16,7 @@ const Link = props => {
navigateParams,
doNavigate,
className,
span,
} = props;
const combinedClassName =
@ -26,7 +27,8 @@ const Link = props => {
const onClick =
!props.onClick && navigate
? () => {
? e => {
e.stopPropagation();
doNavigate(navigate, navigateParams || {});
}
: props.onClick;
@ -44,16 +46,18 @@ const Link = props => {
);
}
return (
<a
className={combinedClassName}
href={href || "javascript:;"}
title={title}
onClick={onClick}
{...("style" in props ? { style: style } : {})}
>
{content}
</a>
const linkProps = {
className: combinedClassName,
href: href || "javascript:;",
title,
onClick,
style,
};
return span ? (
<span {...linkProps}>{content}</span>
) : (
<a {...linkProps}>{content}</a>
);
};

View file

@ -22,7 +22,7 @@ class UriIndicator extends React.PureComponent {
}
render() {
const { claim, link, uri, isResolvingUri, smallCard } = this.props;
const { claim, link, uri, isResolvingUri, smallCard, span } = this.props;
if (isResolvingUri && !claim) {
return <span className="empty">Validating...</span>;
@ -91,6 +91,7 @@ class UriIndicator extends React.PureComponent {
navigate="/show"
navigateParams={{ uri: channelLink }}
className="no-underline"
span={span}
>
{inner}
</Link>