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> <TruncatedText lines={1}>{title}</TruncatedText>
</div> </div>
<div className="card__subtitle"> <div className="card__subtitle">
<span className="card__indicators"> <span className="card__indicators card--file-subtitle">
<FilePrice uri={uri} />{" "} <FilePrice uri={uri} />{" "}
{isRewardContent && <Icon icon={icons.FEATURED} />}{" "} {isRewardContent && <Icon icon={icons.FEATURED} />}{" "}
{fileInfo && <Icon icon={icons.LOCAL} />} {fileInfo && <Icon icon={icons.LOCAL} />}
</span> </span>
<UriIndicator uri={uri} smallCard /> <span className="card--file-subtitle">
<UriIndicator uri={uri} link={true} span={true} smallCard />
</span>
</div> </div>
</div> </div>
{/* Test for nizuka's design: should we remove description? </Link>
{/* Test for nizuka's design: should we remove description?
<div className="card__content card__subtext card__subtext--two-lines"> <div className="card__content card__subtext card__subtext--two-lines">
<TruncatedMarkdown lines={2}>{description}</TruncatedMarkdown> <TruncatedMarkdown lines={2}>{description}</TruncatedMarkdown>
</div> </div>
*/} */}
</Link>
</div> </div>
{obscureNsfw && this.state.hovered && <NsfwOverlay />} {obscureNsfw && this.state.hovered && <NsfwOverlay />}
</section> </section>

View file

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

View file

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