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