From 6718d87848954114a9f348fcc150285ca428b0fb Mon Sep 17 00:00:00 2001 From: saltrafael Date: Tue, 6 Apr 2021 15:59:12 -0300 Subject: [PATCH] Recommended bar: extra options for ease of discovery --- ui/component/claimListDiscover/view.jsx | 10 +- ui/component/recommendedContent/view.jsx | 151 ++++++++++++++++++++--- ui/scss/component/_card.scss | 18 +++ 3 files changed, 159 insertions(+), 20 deletions(-) diff --git a/ui/component/claimListDiscover/view.jsx b/ui/component/claimListDiscover/view.jsx index 18562ea59..bb6ff1c2a 100644 --- a/ui/component/claimListDiscover/view.jsx +++ b/ui/component/claimListDiscover/view.jsx @@ -17,6 +17,8 @@ import { useIsLargeScreen } from 'effects/use-screensize'; type Props = { uris: Array, + showHeader: boolean, + type: string, subscribedChannels: Array, doClaimSearch: ({}) => void, loading: boolean, @@ -72,6 +74,8 @@ function ClaimListDiscover(props: Props) { const { doClaimSearch, claimSearchByQuery, + showHeader = true, + type, claimSearchByQueryLastPageReached, tags, defaultTags, @@ -503,13 +507,15 @@ function ClaimListDiscover(props: Props) { ) : (
+ {showHeader && (
{headerToUse} {meta &&
{meta}
}
- + )} - {loading && new Array(dynamicPageSize).fill(1).map((x, i) => )} + {loading && new Array(dynamicPageSize).fill(1).map((x, i) => )}
)} diff --git a/ui/component/recommendedContent/view.jsx b/ui/component/recommendedContent/view.jsx index 99c659c0a..33a60326a 100644 --- a/ui/component/recommendedContent/view.jsx +++ b/ui/component/recommendedContent/view.jsx @@ -1,10 +1,13 @@ // @flow import { SHOW_ADS, SIMPLE_SITE } from 'config'; import React from 'react'; +import classnames from 'classnames'; import ClaimList from 'component/claimList'; +import ClaimListDiscover from 'component/claimListDiscover'; import Ads from 'web/component/ads'; import Card from 'component/common/card'; import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize'; +import Button from 'component/button'; type Props = { uri: string, @@ -26,6 +29,14 @@ export default function RecommendedContent(props: Props) { isSearching, isAuthenticated, } = props; + const [expanded, setExpanded] = React.useState(false); + const [allRelated, setAllRelated] = React.useState(true); + const [moreFrom, setMoreFrom] = React.useState(false); + const [tagList, setTagList] = React.useState(false); + const signingChannel = claim && claim.signing_channel; + const channelName = signingChannel ? signingChannel.name : null; + const claimValue = claim && claim.value; + const tags = claimValue ? claimValue.tags : null; const isMobile = useIsMobile(); const isMedium = useIsMediumScreen(); @@ -55,25 +66,129 @@ export default function RecommendedContent(props: Props) { smallTitle={!isMobile && !isMedium} className="file-page__recommended" title={__('Related')} - body={ - - ) : ( - !isAuthenticated && - ) + subtitle={ +
+
+ } + body={ +
+ {allRelated && ( + + ) : ( + !isAuthenticated && + ) + ) : ( + false + ) + } + empty={__('No related content found')} + /> + )} + {moreFrom && ( + + ) : ( + !isAuthenticated && + ) + ) : ( + false + ) + } + empty={__('No related content found')} + /> + )} + {tagList && ( + + ) : ( + !isAuthenticated && + ) + ) : ( + false + ) + } + empty={__('No related content found')} + /> + )} +
} /> ); diff --git a/ui/scss/component/_card.scss b/ui/scss/component/_card.scss index 55b8027f4..c787cc079 100644 --- a/ui/scss/component/_card.scss +++ b/ui/scss/component/_card.scss @@ -255,6 +255,24 @@ color: var(--color-text-subtitle); margin: var(--spacing-s) 0; font-size: var(--font-body); + + .button{ + margin: calc(var(--spacing-xxs) / 2) calc(var(--spacing-xxs) / 2); + height: calc(var(--height-button) * 2 / 3); + padding: var(--spacing-s); + border-radius: var(--height-input); + font-size: var(--font-small); + } +} + +.related_content-more--contracted { + margin: calc(var(--spacing-s) * -1) 0; + height: calc(var(--height-button) * 0.9); + overflow: hidden; +} + +.related_content-more--expanded { + margin: calc(var(--spacing-s) * -1) 0; } .card__body {