Merge pull request #632 from lbryio/multisite-styling

Osprey landing page and styling
This commit is contained in:
Travis Eden 2018-10-15 13:42:35 -04:00 committed by GitHub
commit 8e5cb3b3d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 75 additions and 76 deletions

View file

@ -1,11 +1,20 @@
.asset-preview-image {
width : 100%;
padding: 0px;
margin : 0px
padding: 0;
margin : 0;
}
.asset-preview-video {
cursor: pointer;
background-color: #ffffff;
width: calc(100% - 12px - 12px - 2px);
width: 100%;
}
h3.list-title {
margin: 0;
text-overflow: ellipsis;
word-wrap: break-word;
overflow: hidden;
line-height: 1em;
max-height: 2em;
}

View file

@ -1,5 +1,23 @@
.channel-claims-display {
.button--secondary {
margin-right: $secondary-padding;
width: 100%;
display: grid;
grid-gap: 16px;
}
@media (min-width: 1040px) {
.channel-claims-display {
grid-template-columns: 1fr 1fr 1fr 1fr;
}
}
@media (min-width: 768px) and (max-width: 1039px) {
.channel-claims-display {
grid-template-columns: 1fr 1fr;
}
}
@media (max-width: 767px) {
.channel-claims-display {
grid-template-columns: 1fr;
}
}

View file

@ -1,11 +1,11 @@
import React from 'react';
import { Link } from 'react-router-dom';
const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, contentType, thumbnail } }) => {
const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, contentType, thumbnail, title } }) => {
const embedUrl = `/${claimId}/${name}.${fileExt}`;
const showUrl = `/${claimId}/${name}`;
return (
<Link to={showUrl} >
<Link to={showUrl} className='asset-preview'>
{(() => {
switch (contentType) {
case 'image/jpeg':
@ -13,19 +13,25 @@ const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, c
case 'image/png':
case 'image/gif':
return (
<div>
<img
className={'asset-preview-image'}
src={embedUrl}
alt={name}
/>
<h3 className='list-title'>{title}</h3>
</div>
);
case 'video/mp4':
return (
<div>
<img
className={'asset-preview-video'}
src={thumbnail || defaultThumbnail}
alt={name}
/>
<h3 className='list-title'>{title}</h3>
</div>
);
default:
return (

View file

@ -27,58 +27,19 @@ class ChannelClaimsDisplay extends React.Component {
}
render () {
const {channel: {claimsData: {claims, currentPage, totalPages}}, defaultThumbnail} = this.props;
const groupedClaimsList = createGroupedList(claims, 4);
if (claims.length > 0) {
return (
<div className={'channel-claims-display'}>
<div>
{groupedClaimsList.map((group, index) => {
const itemA = group[0];
const itemB = group[1];
const itemC = group[2];
const itemD = group[3];
return (
<HorizontalQuadSplit
key={`claims-row-${index}`}
columnA={
itemA && (
<div>
<div className={'channel-claims-display'}>
{claims.map(claim => (
<AssetPreview
defaultThumbnail={defaultThumbnail}
claimData={itemA}
key={`${itemA.name}-${itemA.id}`}
claimData={claim}
key={`${claim.name}-${claim.id}`}
/>
)
}
columnB={
itemB && (
<AssetPreview
defaultThumbnail={defaultThumbnail}
claimData={itemB}
key={`${itemB.name}-${itemB.id}`}
/>
)
}
columnC={
itemC && (
<AssetPreview
defaultThumbnail={defaultThumbnail}
claimData={itemC}
key={`${itemC.name}-${itemC.id}`}
/>
)
}
columnD={
itemD && (
<AssetPreview
defaultThumbnail={defaultThumbnail}
claimData={itemD}
key={`${itemD.name}-${itemD.id}`}
/>
)
}
/>
);
})}
))}
</div>
</div>
<Row>
{(currentPage > 1) &&

View file

@ -1,19 +1,20 @@
import { connect } from 'react-redux';
import View from './view';
const mapStateToProps = ({ show }) => {
const mapStateToProps = ({ show, site, channel }) => {
// select request info
const requestId = show.request.id;
// select request
const previousRequest = show.requestList[requestId] || null;
// select channel
let channel;
let thisChannel;
if (previousRequest) {
const channelKey = previousRequest.key;
channel = show.channelList[channelKey] || null;
thisChannel = show.channelList[channelKey] || null;
}
return {
channel,
channel : thisChannel,
homeChannel: site.publishOnlyApproved && !channel.loggedInChannel.name ? `${site.approvedChannels[0].name}:${site.approvedChannels[0].longId}` : null,
};
};

View file

@ -7,7 +7,7 @@ import Row from '@components/Row';
class ShowChannel extends React.Component {
render () {
const { channel } = this.props;
const { channel, homeChannel } = this.props;
if (channel) {
const { name, longId, shortId } = channel;
return (
@ -15,6 +15,7 @@ class ShowChannel extends React.Component {
pageTitle={name}
channel={channel}
>
{!homeChannel && (
<Row>
<ChannelInfoDisplay
name={name}
@ -22,7 +23,10 @@ class ShowChannel extends React.Component {
shortId={shortId}
/>
</Row>
)}
<Row>
<ChannelClaimsDisplay />
</Row>
</PageLayout>
);
}