Merge pull request #869 from daovist/master

make channel names on discover page links
This commit is contained in:
Sean Yesmunt 2017-12-14 16:15:13 -05:00 committed by GitHub
commit d1e0f9dd99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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>
</Link>
{/* Test for nizuka's design: should we remove description? {/* 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>