add card style for lists of claims

This commit is contained in:
Sean Yesmunt 2020-04-29 15:31:11 -04:00
parent 52f704fa0f
commit a5cc1a84aa
9 changed files with 44 additions and 19 deletions

View file

@ -6,7 +6,6 @@ import classnames from 'classnames';
import ClaimPreview from 'component/claimPreview'; import ClaimPreview from 'component/claimPreview';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
import { FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
import Card from 'component/common/card';
import usePersistedState from 'effects/use-persisted-state'; import usePersistedState from 'effects/use-persisted-state';
const SORT_NEW = 'new'; const SORT_NEW = 'new';
@ -34,6 +33,7 @@ type Props = {
hideBlock: boolean, hideBlock: boolean,
injectedItem: ?Node, injectedItem: ?Node,
timedOutMessage?: Node, timedOutMessage?: Node,
isCardBody?: boolean,
}; };
export default function ClaimList(props: Props) { export default function ClaimList(props: Props) {
@ -58,6 +58,7 @@ export default function ClaimList(props: Props) {
hideBlock, hideBlock,
injectedItem, injectedItem,
timedOutMessage, timedOutMessage,
isCardBody = false,
} = props; } = props;
const [scrollBottomCbMap, setScrollBottomCbMap] = useState({}); const [scrollBottomCbMap, setScrollBottomCbMap] = useState({});
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW); const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
@ -104,6 +105,7 @@ export default function ClaimList(props: Props) {
<section <section
className={classnames('claim-list', { className={classnames('claim-list', {
'claim-list--small': type === 'small', 'claim-list--small': type === 'small',
'claim-list--card-body': isCardBody,
})} })}
> >
{header !== false && ( {header !== false && (
@ -134,7 +136,11 @@ export default function ClaimList(props: Props) {
)} )}
{urisLength > 0 && ( {urisLength > 0 && (
<ul className="card ul--no-style"> <ul
className={classnames('ul--no-style', {
card: !isCardBody,
})}
>
{sortedUris.map((uri, index) => ( {sortedUris.map((uri, index) => (
<React.Fragment key={uri}> <React.Fragment key={uri}>
{injectedItem && index === 4 && <li>{injectedItem}</li>} {injectedItem && index === 4 && <li>{injectedItem}</li>}

View file

@ -5,7 +5,7 @@ import Tag from 'component/tag';
const SLIM_TAGS = 1; const SLIM_TAGS = 1;
const NORMAL_TAGS = 3; const NORMAL_TAGS = 3;
const LARGE_TAGS = 10; const LARGE_TAGS = 6;
type Props = { type Props = {
tags: Array<string>, tags: Array<string>,

View file

@ -15,7 +15,7 @@ type Props = {
icon?: string, icon?: string,
className?: string, className?: string,
isPageTitle?: boolean, isPageTitle?: boolean,
isBodyTable?: boolean, isBodyList?: boolean,
defaultExpand?: boolean, defaultExpand?: boolean,
nag?: Node, nag?: Node,
}; };
@ -30,7 +30,7 @@ export default function Card(props: Props) {
icon, icon,
className, className,
isPageTitle = false, isPageTitle = false,
isBodyTable = false, isBodyList = false,
defaultExpand, defaultExpand,
nag, nag,
} = props; } = props;
@ -70,7 +70,7 @@ export default function Card(props: Props) {
<div <div
className={classnames('card__body', { className={classnames('card__body', {
'card__body--no-title': !title && !subtitle, 'card__body--no-title': !title && !subtitle,
'card__body--table': isBodyTable, 'card__body--list': isBodyList,
})} })}
> >
{body} {body}

View file

@ -34,7 +34,7 @@ type Props = {
thumbnail: string, thumbnail: string,
}; };
class FileRender extends React.PureComponent<Props, State> { class FileRender extends React.PureComponent<Props> {
constructor(props: Props) { constructor(props: Props) {
super(props); super(props);

View file

@ -2,6 +2,7 @@
import React from 'react'; import React from 'react';
import ClaimList from 'component/claimList'; import ClaimList from 'component/claimList';
import Ads from 'lbrytv/component/ads'; import Ads from 'lbrytv/component/ads';
import Card from 'component/common/card';
type Options = { type Options = {
related_to: string, related_to: string,
@ -63,13 +64,19 @@ export default class RecommendedContent extends React.PureComponent<Props> {
const { recommendedContent, isSearching, isAuthenticated } = this.props; const { recommendedContent, isSearching, isAuthenticated } = this.props;
return ( return (
<ClaimList <Card
type="small" isBodyList
loading={isSearching} title={__('Related')}
uris={recommendedContent} body={
injectedItem={!isAuthenticated && IS_WEB && <Ads type="video" small />} <ClaimList
header={__('Related')} isCardBody
empty={__('No related content found')} type="small"
loading={isSearching}
uris={recommendedContent}
injectedItem={!isAuthenticated && IS_WEB && <Ads type="video" small />}
empty={__('No related content found')}
/>
}
/> />
); );
} }

View file

@ -178,7 +178,7 @@ function TxoList(props: Props) {
<Button button="secondary" label={__('Refresh')} onClick={() => fetchTxoPage()} /> <Button button="secondary" label={__('Refresh')} onClick={() => fetchTxoPage()} />
</div> </div>
} }
isBodyTable isBodyList
body={ body={
<div> <div>
<div className="card__body-actions"> <div className="card__body-actions">

View file

@ -212,7 +212,7 @@ class HelpPage extends React.PureComponent<Props, State> {
</span> </span>
) : null ) : null
} }
isBodyTable isBodyList
body={ body={
<div className="table__wrapper"> <div className="table__wrapper">
<table className="table table--stretch"> <table className="table table--stretch">

View file

@ -205,7 +205,7 @@
padding-top: 0; padding-top: 0;
} }
&.card__body--table { &.card__body--list {
padding: 0; padding: 0;
border-top: 1px solid var(--color-border); border-top: 1px solid var(--color-border);
} }

View file

@ -4,6 +4,17 @@
} }
} }
.claim-list--card-body {
.claim-preview {
padding: 0 var(--spacing-medium);
padding-right: 0;
@media (max-width: $breakpoint-small) {
padding: 0;
}
}
}
.claim-list__header { .claim-list__header {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -110,8 +121,8 @@
font-size: 14px; font-size: 14px;
.media__thumb { .media__thumb {
width: 5rem; width: 8rem;
height: 3rem; height: auto;
} }
.channel-thumbnail { .channel-thumbnail {
@ -145,6 +156,7 @@
.claim-preview--small { .claim-preview--small {
.media__thumb { .media__thumb {
width: 8rem; width: 8rem;
height: auto;
} }
.channel-thumbnail { .channel-thumbnail {