fix channel name alignment on file page #776

Merged
neb-b merged 2 commits from alignment-issues into master 2017-11-22 21:50:26 +01:00
5 changed files with 54 additions and 31 deletions

View file

@ -59,9 +59,8 @@ class FileCard extends React.PureComponent {
const uri = lbryuri.normalize(this.props.uri); const uri = lbryuri.normalize(this.props.uri);
const title = metadata && metadata.title ? metadata.title : uri; const title = metadata && metadata.title ? metadata.title : uri;
const thumbnail = metadata && metadata.thumbnail const thumbnail =
? metadata.thumbnail metadata && metadata.thumbnail ? metadata.thumbnail : null;
: null;
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
const isRewardContent = const isRewardContent =
claim && rewardedContentClaimIds.includes(claim.claim_id); claim && rewardedContentClaimIds.includes(claim.claim_id);
@ -96,13 +95,11 @@ class FileCard extends React.PureComponent {
</div> </div>
<div className="card__subtitle"> <div className="card__subtitle">
<span className="card__indicators"> <span className="card__indicators">
<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} /> <UriIndicator uri={uri} smallCard />
</div> </div>
</div> </div>
{/* Test for nizuka's design: should we remove description? {/* Test for nizuka's design: should we remove description?

View file

@ -21,7 +21,7 @@ class UriIndicator extends React.PureComponent {
} }
render() { render() {
const { claim, link, uri, isResolvingUri } = this.props; const { claim, link, uri, isResolvingUri, smallCard } = this.props;
if (isResolvingUri && !claim) { if (isResolvingUri && !claim) {
return <span className="empty">Validating...</span>; return <span className="empty">Validating...</span>;
@ -60,7 +60,9 @@ class UriIndicator extends React.PureComponent {
const inner = ( const inner = (
<span> <span>
<span className="channel-name">{channelName}</span>{" "} <span className={`channel-name ${smallCard && "channel-name--small"}`}>
{channelName}
</span>{" "}
{!signatureIsValid ? ( {!signatureIsValid ? (
<Icon <Icon
icon={icon} icon={icon}

View file

@ -65,38 +65,45 @@ class FilePage extends React.PureComponent {
return ( return (
<section className={"card " + (obscureNsfw ? "card--obscured " : "")}> <section className={"card " + (obscureNsfw ? "card--obscured " : "")}>
<div className="show-page-media"> <div className="show-page-media">
{isPlayable {isPlayable ? (
? <Video className="video-embedded" uri={uri} /> <Video className="video-embedded" uri={uri} />
: metadata && metadata.thumbnail ) : metadata && metadata.thumbnail ? (
? <Thumbnail src={metadata.thumbnail} /> <Thumbnail src={metadata.thumbnail} />
: <Thumbnail />} ) : (
<Thumbnail />
)}
</div> </div>
<div className="card__inner"> <div className="card__inner">
{(!tab || tab === "details") && {(!tab || tab === "details") && (
<div> <div>
{" "} {" "} {" "}
<div className="card__title-identity"> <div className="card__title-identity">
{!fileInfo || fileInfo.written_bytes <= 0 {!fileInfo || fileInfo.written_bytes <= 0 ? (
? <span style={{ float: "right" }}> <span style={{ float: "right" }}>
<FilePrice uri={lbryuri.normalize(uri)} /> <FilePrice uri={lbryuri.normalize(uri)} />
{isRewardContent && {isRewardContent && (
<span>{" "}<Icon icon={icons.FEATURED} /></span>}
</span>
: null}
<h1>{title}</h1>
<div className="card__subtitle">
<UriIndicator uri={uri} link={true} />
<span className="divider__vertical">&bull;</span>
<span> <span>
{" "}
<Icon icon={icons.FEATURED} />
</span>
)}
</span>
) : null}
<h1>{title}</h1>
<div className="card__subtitle card--file-subtitle">
<UriIndicator uri={uri} link={true} />
<span className="card__publish-date">
Published on{" "} Published on{" "}
<DateTime block={height} show={DateTime.SHOW_DATE} /> <DateTime block={height} show={DateTime.SHOW_DATE} />
</span> </span>
</div> </div>
</div> </div>
<FileDetails uri={uri} /> <FileDetails uri={uri} />
</div>} </div>
{tab === "tip" && )}
<WalletSendTip claim_id={claim.claim_id} uri={uri} />} {tab === "tip" && (
<WalletSendTip claim_id={claim.claim_id} uri={uri} />
)}
</div> </div>
</section> </section>
); );

View file

@ -194,6 +194,18 @@ $font-size-subtext-multiple: 0.82;
line-height: calc( var(--font-line-height) * 1 / 0.85); line-height: calc( var(--font-line-height) * 1 / 0.85);
} }
.card--file-subtitle {
display: flex;
}
// this is too specific
// it should be a helper class
// ex. ".m-padding-left"
// will come back to this during the redesign - sean
.card__publish-date {
padding-left: 20px;
}
.card-series-submit .card-series-submit
{ {
margin-left: auto; margin-left: auto;

View file

@ -1,12 +1,17 @@
.channel-name { .channel-name {
width: calc(var(--card-small-width) * 2 / 3);
display: inline-block; display: inline-block;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis text-overflow: ellipsis
} }
// this shouldn't know about the card width
// will come back to this for the redesign - sean
.channel-name--small {
width: calc(var(--card-small-width) * 2 / 3);
}
.channel-indicator__icon--invalid { .channel-indicator__icon--invalid {
color: var(--color-error); color: var(--color-error);
} }