fix placeholder style for dark mode
This commit is contained in:
parent
3c87c47632
commit
b40b64cb6e
9 changed files with 40 additions and 28 deletions
|
@ -11,7 +11,11 @@ type Props = {
|
||||||
onComponent?: boolean, // extra padding to account for button/form field size
|
onComponent?: boolean, // extra padding to account for button/form field size
|
||||||
};
|
};
|
||||||
|
|
||||||
class ToolTip extends React.PureComponent<Props> {
|
type State = {
|
||||||
|
direction: string,
|
||||||
|
};
|
||||||
|
|
||||||
|
class ToolTip extends React.PureComponent<Props, State> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
direction: 'bottom',
|
direction: 'bottom',
|
||||||
};
|
};
|
||||||
|
@ -34,6 +38,9 @@ class ToolTip extends React.PureComponent<Props> {
|
||||||
|
|
||||||
// Get parent-container
|
// Get parent-container
|
||||||
const viewport = document.getElementById('content');
|
const viewport = document.getElementById('content');
|
||||||
|
if (!viewport) {
|
||||||
|
throw Error('Document must contain parent div with #content');
|
||||||
|
}
|
||||||
|
|
||||||
const visibility = {
|
const visibility = {
|
||||||
top: rect.top >= 0,
|
top: rect.top >= 0,
|
||||||
|
|
|
@ -42,6 +42,8 @@ class DateTime extends React.PureComponent<Props> {
|
||||||
const show = this.props.show || DateTime.SHOW_BOTH;
|
const show = this.props.show || DateTime.SHOW_BOTH;
|
||||||
const locale = app.i18n.getLocale();
|
const locale = app.i18n.getLocale();
|
||||||
|
|
||||||
|
// If !date, it's currently being fetched
|
||||||
|
|
||||||
if (timeAgo) {
|
if (timeAgo) {
|
||||||
return date ? <span>{moment(date).from(moment())}</span> : <span />;
|
return date ? <span>{moment(date).from(moment())}</span> : <span />;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ const select = (state, props) => {
|
||||||
...fileCardInfo,
|
...fileCardInfo,
|
||||||
pending: !!pendingPublish,
|
pending: !!pendingPublish,
|
||||||
position: makeSelectContentPositionForUri(props.uri)(state),
|
position: makeSelectContentPositionForUri(props.uri)(state),
|
||||||
subscribed: makeSelectIsSubscribed(props.uri)(state),
|
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ type Props = {
|
||||||
resolveUri: string => void,
|
resolveUri: string => void,
|
||||||
isResolvingUri: boolean,
|
isResolvingUri: boolean,
|
||||||
/* eslint-enable react/no-unused-prop-types */
|
/* eslint-enable react/no-unused-prop-types */
|
||||||
subscribed: boolean,
|
isSubscribed: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileCard extends React.PureComponent<Props> {
|
class FileCard extends React.PureComponent<Props> {
|
||||||
|
@ -56,10 +56,10 @@ class FileCard extends React.PureComponent<Props> {
|
||||||
obscureNsfw,
|
obscureNsfw,
|
||||||
claimIsMine,
|
claimIsMine,
|
||||||
pending,
|
pending,
|
||||||
subscribed,
|
isSubscribed,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (!claim) {
|
if (!claim && !pending) {
|
||||||
return (
|
return (
|
||||||
<div className="card card--small">
|
<div className="card card--small">
|
||||||
<div className="card--placeholder card__media" />
|
<div className="card--placeholder card__media" />
|
||||||
|
@ -78,8 +78,8 @@ class FileCard extends React.PureComponent<Props> {
|
||||||
const uri = !pending ? normalizeURI(this.props.uri) : this.props.uri;
|
const uri = !pending ? normalizeURI(this.props.uri) : this.props.uri;
|
||||||
const title = metadata && metadata.title ? metadata.title : uri;
|
const title = metadata && metadata.title ? metadata.title : uri;
|
||||||
const thumbnail = metadata && metadata.thumbnail ? metadata.thumbnail : null;
|
const thumbnail = metadata && metadata.thumbnail ? metadata.thumbnail : null;
|
||||||
const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
|
const isRewardContent = claim && rewardedContentClaimIds.includes(claim.claim_id);
|
||||||
const { height } = claim;
|
const height = claim && claim.height;
|
||||||
const handleContextMenu = event => {
|
const handleContextMenu = event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -112,7 +112,7 @@ class FileCard extends React.PureComponent<Props> {
|
||||||
<div className="card__file-properties">
|
<div className="card__file-properties">
|
||||||
<FilePrice hideFree uri={uri} />
|
<FilePrice hideFree uri={uri} />
|
||||||
{isRewardContent && <Icon iconColor="red" icon={icons.FEATURED} />}
|
{isRewardContent && <Icon iconColor="red" icon={icons.FEATURED} />}
|
||||||
{subscribed && <Icon icon={icons.HEART} />}
|
{isSubscribed && <Icon icon={icons.HEART} />}
|
||||||
{fileInfo && <Icon icon={icons.LOCAL} />}
|
{fileInfo && <Icon icon={icons.LOCAL} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,7 +22,7 @@ const select = (state, props) => ({
|
||||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
||||||
obscureNsfw: !selectShowNsfw(state),
|
obscureNsfw: !selectShowNsfw(state),
|
||||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||||
subscribed: makeSelectIsSubscribed(props.uri)(state),
|
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -13,7 +13,6 @@ import UriIndicator from 'component/uriIndicator';
|
||||||
import DateTime from 'component/dateTime';
|
import DateTime from 'component/dateTime';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
showLocal: boolean,
|
|
||||||
obscureNsfw: boolean,
|
obscureNsfw: boolean,
|
||||||
claimIsMine: boolean,
|
claimIsMine: boolean,
|
||||||
isDownloaded: boolean,
|
isDownloaded: boolean,
|
||||||
|
@ -30,12 +29,11 @@ type Props = {
|
||||||
displayHiddenMessage?: boolean,
|
displayHiddenMessage?: boolean,
|
||||||
displayDescription?: boolean,
|
displayDescription?: boolean,
|
||||||
size: string,
|
size: string,
|
||||||
subscribed: boolean,
|
isSubscribed: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileTile extends React.PureComponent<Props> {
|
class FileTile extends React.PureComponent<Props> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
showLocal: false,
|
|
||||||
displayDescription: true,
|
displayDescription: true,
|
||||||
size: 'regular',
|
size: 'regular',
|
||||||
};
|
};
|
||||||
|
@ -50,24 +48,34 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
if (!isResolvingUri && claim === undefined && uri) resolveUri(uri);
|
if (!isResolvingUri && claim === undefined && uri) resolveUri(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderFileProperties() {
|
||||||
|
const { isSubscribed, isDownloaded, claim, uri, rewardedContentClaimIds, size } = this.props;
|
||||||
|
const isRewardContent = claim && rewardedContentClaimIds.includes(claim.claim_id);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={classnames('card__file-properties', { card__subtitle: size === 'large' })}>
|
||||||
|
<FilePrice hideFree uri={uri} />
|
||||||
|
{isSubscribed && <Icon icon={icons.HEART} />}
|
||||||
|
{isRewardContent && <Icon iconColor="red" icon={icons.FEATURED} />}
|
||||||
|
{isDownloaded && <Icon icon={icons.LOCAL} />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
claim,
|
claim,
|
||||||
metadata,
|
metadata,
|
||||||
isResolvingUri,
|
isResolvingUri,
|
||||||
navigate,
|
navigate,
|
||||||
rewardedContentClaimIds,
|
|
||||||
obscureNsfw,
|
obscureNsfw,
|
||||||
claimIsMine,
|
claimIsMine,
|
||||||
showLocal,
|
|
||||||
isDownloaded,
|
|
||||||
clearPublish,
|
clearPublish,
|
||||||
updatePublishForm,
|
updatePublishForm,
|
||||||
hideNoResult,
|
hideNoResult,
|
||||||
displayHiddenMessage,
|
displayHiddenMessage,
|
||||||
displayDescription,
|
displayDescription,
|
||||||
size,
|
size,
|
||||||
subscribed,
|
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (!claim && isResolvingUri) {
|
if (!claim && isResolvingUri) {
|
||||||
|
@ -105,12 +113,11 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
const title =
|
const title =
|
||||||
isClaimed && metadata && metadata.title ? metadata.title : parseURI(uri).contentName;
|
isClaimed && metadata && metadata.title ? metadata.title : parseURI(uri).contentName;
|
||||||
const thumbnail = metadata && metadata.thumbnail ? metadata.thumbnail : null;
|
const thumbnail = metadata && metadata.thumbnail ? metadata.thumbnail : null;
|
||||||
const isRewardContent = claim && rewardedContentClaimIds.includes(claim.claim_id);
|
|
||||||
const onClick = () => navigate('/show', { uri });
|
const onClick = () => navigate('/show', { uri });
|
||||||
|
|
||||||
let height;
|
let height;
|
||||||
let name;
|
let name;
|
||||||
if (isClaimed) {
|
if (claim) {
|
||||||
({ name, height } = claim);
|
({ name, height } = claim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,25 +135,21 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
<CardMedia title={title || name} thumbnail={thumbnail} />
|
<CardMedia title={title || name} thumbnail={thumbnail} />
|
||||||
<div className="file-tile__info">
|
<div className="file-tile__info">
|
||||||
<div className="file-tile__title">
|
<div className="file-tile__title">
|
||||||
<TruncatedText text={title || name} lines={size === 'small' ? 2 : 3} />
|
{(title || name) && <TruncatedText text={title || name} lines={size === 'small' ? 2 : 3} />}
|
||||||
</div>
|
</div>
|
||||||
<div className="card__subtitle">
|
<div className="card__subtitle">
|
||||||
<UriIndicator uri={uri} link />
|
<UriIndicator uri={uri} link />
|
||||||
</div>
|
</div>
|
||||||
<div className="card__subtitle card--space-between">
|
<div className="card__subtitle card--space-between">
|
||||||
<DateTime timeAgo block={height} />
|
<DateTime timeAgo block={height} />
|
||||||
<div className="card__file-properties">
|
{size !== 'large' && this.renderFileProperties()}
|
||||||
<FilePrice hideFree uri={uri} />
|
|
||||||
{subscribed && <Icon icon={icons.HEART} />}
|
|
||||||
{isRewardContent && <Icon iconColor="red" icon={icons.FEATURED} />}
|
|
||||||
{showLocal && isDownloaded && <Icon icon={icons.LOCAL} />}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{displayDescription && (
|
{displayDescription && (
|
||||||
<div className="card__subtext">
|
<div className="card__subtext">
|
||||||
<TruncatedText text={description} lines={size === 'large' ? 4 : 3} />
|
<TruncatedText text={description} lines={size === 'large' ? 4 : 3} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{size === 'large' && this.renderFileProperties()}
|
||||||
{!name && (
|
{!name && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{__('This location is unused.')}{' '}
|
{__('This location is unused.')}{' '}
|
||||||
|
|
|
@ -57,7 +57,6 @@ export default class RecommendedContent extends React.PureComponent<Props> {
|
||||||
<FileTile
|
<FileTile
|
||||||
size="small"
|
size="small"
|
||||||
hideNoResult
|
hideNoResult
|
||||||
showLocal
|
|
||||||
displayDescription={false}
|
displayDescription={false}
|
||||||
key={recommendedUri}
|
key={recommendedUri}
|
||||||
uri={recommendedUri}
|
uri={recommendedUri}
|
||||||
|
|
|
@ -121,12 +121,13 @@
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
|
|
||||||
&:not(:first-of-type) {
|
&:not(:first-of-type) {
|
||||||
margin-top: $spacing-vertical * 3/2;
|
padding-top: $spacing-vertical * 3/2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__subtext {
|
.card__subtext {
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
padding-top: $spacing-vertical * 1/3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__meta {
|
.card__meta {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
.card--placeholder {
|
.card--placeholder {
|
||||||
animation: pulse 2s infinite ease-in-out;
|
animation: pulse 2s infinite ease-in-out;
|
||||||
background: #eeeeee;
|
background: var(--color-placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Individual items we need a placeholder for
|
// Individual items we need a placeholder for
|
||||||
|
|
Loading…
Reference in a new issue