fix styles
This commit is contained in:
parent
8a32006988
commit
b7adc597e2
5 changed files with 51 additions and 27 deletions
|
@ -7,9 +7,11 @@ import { parseURI } from 'lbry-redux';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
|
link?: boolean,
|
||||||
title: ?string,
|
title: ?string,
|
||||||
claim: StreamClaim,
|
claim: StreamClaim,
|
||||||
children: React.Node,
|
children: React.Node,
|
||||||
|
className: ?string,
|
||||||
thumbnail: ?string,
|
thumbnail: ?string,
|
||||||
autoEmbed: ?boolean,
|
autoEmbed: ?boolean,
|
||||||
description: ?string,
|
description: ?string,
|
||||||
|
@ -25,6 +27,7 @@ type Props = {
|
||||||
class ClaimLink extends React.Component<Props> {
|
class ClaimLink extends React.Component<Props> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
href: null,
|
href: null,
|
||||||
|
link: false,
|
||||||
title: null,
|
title: null,
|
||||||
thumbnail: null,
|
thumbnail: null,
|
||||||
autoEmbed: false,
|
autoEmbed: false,
|
||||||
|
@ -64,7 +67,19 @@ class ClaimLink extends React.Component<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { uri, claim, title, description, thumbnail, currentTheme, autoEmbed, children, isResolvingUri } = this.props;
|
const {
|
||||||
|
uri,
|
||||||
|
link,
|
||||||
|
claim,
|
||||||
|
title,
|
||||||
|
className,
|
||||||
|
description,
|
||||||
|
thumbnail,
|
||||||
|
currentTheme,
|
||||||
|
autoEmbed,
|
||||||
|
children,
|
||||||
|
isResolvingUri,
|
||||||
|
} = this.props;
|
||||||
const isUnresolved = (!isResolvingUri && !claim) || !claim;
|
const isUnresolved = (!isResolvingUri && !claim) || !claim;
|
||||||
const isBlacklisted = this.isClaimBlackListed();
|
const isBlacklisted = this.isClaimBlackListed();
|
||||||
|
|
||||||
|
@ -77,13 +92,13 @@ class ClaimLink extends React.Component<Props> {
|
||||||
const isChannelClaim = isChannel && !path;
|
const isChannelClaim = isChannel && !path;
|
||||||
const showPreview = autoEmbed === true && !isUnresolved;
|
const showPreview = autoEmbed === true && !isUnresolved;
|
||||||
|
|
||||||
const link = (
|
const innerContent = (
|
||||||
<Button
|
<Button
|
||||||
label={children}
|
label={children}
|
||||||
title={!isChannelClaim ? title || claimName : undefined}
|
title={!isChannelClaim ? title || claimName : undefined}
|
||||||
button={!isChannel ? 'link' : undefined}
|
button={link ? 'link' : undefined}
|
||||||
|
className={className}
|
||||||
navigate={uri}
|
navigate={uri}
|
||||||
className="button--uri-indicator"
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -98,13 +113,13 @@ class ClaimLink extends React.Component<Props> {
|
||||||
thumbnail={thumbnail}
|
thumbnail={thumbnail}
|
||||||
description={description}
|
description={description}
|
||||||
>
|
>
|
||||||
<span>{link}</span>
|
<span>{innerContent}</span>
|
||||||
</ChannelTooltip>
|
</ChannelTooltip>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{isChannelClaim ? wrappedLink : link}
|
{isChannelClaim ? wrappedLink : innerContent}
|
||||||
{showPreview && <PreviewLink uri={uri} />}
|
{showPreview && <PreviewLink uri={uri} />}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ExternalLink extends React.PureComponent<Props> {
|
||||||
// Return local link if protocol is lbry uri
|
// Return local link if protocol is lbry uri
|
||||||
if (protocol && protocol[0] === 'lbry:' && isURIValid(href)) {
|
if (protocol && protocol[0] === 'lbry:' && isURIValid(href)) {
|
||||||
element = (
|
element = (
|
||||||
<ClaimLink uri={href} autoEmbed={embed}>
|
<ClaimLink uri={href} autoEmbed={embed} link>
|
||||||
{children}
|
{children}
|
||||||
</ClaimLink>
|
</ClaimLink>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import DateTime from 'component/dateTime';
|
|
||||||
import UriIndicator from 'component/uriIndicator';
|
import UriIndicator from 'component/uriIndicator';
|
||||||
import TruncatedText from 'component/common/truncated-text';
|
import TruncatedText from 'component/common/truncated-text';
|
||||||
import MarkdownPreview from 'component/common/markdown-preview';
|
import MarkdownPreview from 'component/common/markdown-preview';
|
||||||
|
@ -31,18 +30,19 @@ class PreviewLink extends React.PureComponent<Props> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className={'preview-link'} role="button" onClick={this.handleClick}>
|
<span className={'preview-link'} role="button" onClick={this.handleClick}>
|
||||||
<span className={'media-tile media-tile--small card--link'}>
|
<span className={'file-list__item'}>
|
||||||
<span style={thumbnailStyle} className={'preview-link--thumbnail media__thumb'} />
|
<span style={thumbnailStyle} className={'preview-link__thumbnail media__thumb'} />
|
||||||
<span className={'preview-link--text media__info'}>
|
<span className={'file-list__item-metadata'}>
|
||||||
<span className={'preview-link--title media__title'}>
|
<span className={'file-list__item-info'}>
|
||||||
|
<span className={'file-list__item-title'}>
|
||||||
<TruncatedText text={title} lines={1} />
|
<TruncatedText text={title} lines={1} />
|
||||||
</span>
|
</span>
|
||||||
<span className={'preview-link--description media__subtext'}>
|
|
||||||
<span className={'truncated-text'}>
|
|
||||||
{__('Published to')} <UriIndicator uri={uri} link /> <DateTime timeAgo uri={uri} />
|
|
||||||
</span>
|
</span>
|
||||||
|
<span className={'preview-link__description media__subtext'}>
|
||||||
|
<UriIndicator uri={uri} link />
|
||||||
</span>
|
</span>
|
||||||
<span className={'preview-link--description media__subtext'}>
|
<span className={'file-list__item-properties'}>
|
||||||
|
<span className={'preview-link__description media__subtext'}>
|
||||||
<TruncatedText lines={2} showTooltip={false}>
|
<TruncatedText lines={2} showTooltip={false}>
|
||||||
<MarkdownPreview content={description} promptLinks strip />
|
<MarkdownPreview content={description} promptLinks strip />
|
||||||
</TruncatedText>
|
</TruncatedText>
|
||||||
|
@ -50,6 +50,7 @@ class PreviewLink extends React.PureComponent<Props> {
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,11 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||||
return inner;
|
return inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <ClaimLink uri={channelLink}>{inner}</ClaimLink>;
|
return (
|
||||||
|
<ClaimLink uri={channelLink} className={'button--uri-indicator'}>
|
||||||
|
{inner}
|
||||||
|
</ClaimLink>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,17 +122,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-link {
|
.preview-link {
|
||||||
margin: var(--spacing-vertical-medium) 0;
|
padding: 0;
|
||||||
padding: 1.2rem 0.8rem;
|
margin: 1rem 0;
|
||||||
background-color: rgba($lbry-teal-5, 0.1);
|
background-color: rgba($lbry-teal-5, 0.1);
|
||||||
border-left: 0.5rem solid $lbry-teal-5;
|
border-left: 0.5rem solid $lbry-teal-5;
|
||||||
display: block;
|
display: block;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 40rem;
|
width: 40rem;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-link--description {
|
.preview-link__thumbnail {
|
||||||
|
width: 12rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-link__description {
|
||||||
display: block;
|
display: block;
|
||||||
margin: var(--spacing-vertical-medium) 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue