|
@@ -7,17 +7,18 @@ import {
|
|
GetVideosConnectionQueryVariables,
|
|
GetVideosConnectionQueryVariables,
|
|
VideoWhereInput,
|
|
VideoWhereInput,
|
|
} from '@/api/queries'
|
|
} from '@/api/queries'
|
|
-import { Grid, GridHeadingContainer, LoadMoreButton, SkeletonLoader, Text } from '@/shared/components'
|
|
|
|
|
|
+import { Grid, GridHeadingContainer, LoadMoreButton, SkeletonLoader, Text, TitleContainer } from '@/shared/components'
|
|
import { SvgGlyphChevronRight } from '@/shared/icons'
|
|
import { SvgGlyphChevronRight } from '@/shared/icons'
|
|
import { SentryLogger } from '@/utils/logs'
|
|
import { SentryLogger } from '@/utils/logs'
|
|
|
|
|
|
-import { AdditionalLink, LoadMoreButtonWrapper, TitleWrapper } from './InfiniteGrid.style'
|
|
|
|
|
|
+import { AdditionalLink, LoadMoreButtonWrapper } from './InfiniteGrid.style'
|
|
import { useInfiniteGrid } from './useInfiniteGrid'
|
|
import { useInfiniteGrid } from './useInfiniteGrid'
|
|
|
|
|
|
import { VideoTile } from '../VideoTile'
|
|
import { VideoTile } from '../VideoTile'
|
|
|
|
|
|
type InfiniteVideoGridProps = {
|
|
type InfiniteVideoGridProps = {
|
|
title?: string
|
|
title?: string
|
|
|
|
+ titleLoader?: boolean
|
|
categoryId?: string
|
|
categoryId?: string
|
|
channelId?: string
|
|
channelId?: string
|
|
channelIdIn?: string[] | null
|
|
channelIdIn?: string[] | null
|
|
@@ -62,6 +63,7 @@ export const InfiniteVideoGrid: React.FC<InfiniteVideoGridProps> = ({
|
|
onDemand = false,
|
|
onDemand = false,
|
|
additionalLink,
|
|
additionalLink,
|
|
isFeatured = false,
|
|
isFeatured = false,
|
|
|
|
+ titleLoader,
|
|
}) => {
|
|
}) => {
|
|
const [videosPerRow, setVideosPerRow] = useState(INITIAL_VIDEOS_PER_ROW)
|
|
const [videosPerRow, setVideosPerRow] = useState(INITIAL_VIDEOS_PER_ROW)
|
|
const queryVariables: { where: VideoWhereInput } = {
|
|
const queryVariables: { where: VideoWhereInput } = {
|
|
@@ -172,10 +174,14 @@ export const InfiniteVideoGrid: React.FC<InfiniteVideoGridProps> = ({
|
|
// Right now we'll make the first request and then right after another one based on the resized columns
|
|
// Right now we'll make the first request and then right after another one based on the resized columns
|
|
return (
|
|
return (
|
|
<section className={className}>
|
|
<section className={className}>
|
|
- <TitleWrapper>
|
|
|
|
|
|
+ <GridHeadingContainer>
|
|
{title && (
|
|
{title && (
|
|
- <GridHeadingContainer>
|
|
|
|
- {!ready ? <SkeletonLoader height={23} width={250} /> : <Text variant="h4">{title}</Text>}
|
|
|
|
|
|
+ <TitleContainer>
|
|
|
|
+ {(!ready || !displayedItems.length) && titleLoader ? (
|
|
|
|
+ <SkeletonLoader height={30} width={250} />
|
|
|
|
+ ) : (
|
|
|
|
+ <Text variant="h4">{title}</Text>
|
|
|
|
+ )}
|
|
{additionalLink && (
|
|
{additionalLink && (
|
|
<AdditionalLink
|
|
<AdditionalLink
|
|
to={additionalLink.url}
|
|
to={additionalLink.url}
|
|
@@ -187,9 +193,9 @@ export const InfiniteVideoGrid: React.FC<InfiniteVideoGridProps> = ({
|
|
{additionalLink.name}
|
|
{additionalLink.name}
|
|
</AdditionalLink>
|
|
</AdditionalLink>
|
|
)}
|
|
)}
|
|
- </GridHeadingContainer>
|
|
|
|
|
|
+ </TitleContainer>
|
|
)}
|
|
)}
|
|
- </TitleWrapper>
|
|
|
|
|
|
+ </GridHeadingContainer>
|
|
<Grid onResize={(sizes) => setVideosPerRow(sizes.length)}>{gridContent}</Grid>
|
|
<Grid onResize={(sizes) => setVideosPerRow(sizes.length)}>{gridContent}</Grid>
|
|
{shouldShowLoadMoreButton && (
|
|
{shouldShowLoadMoreButton && (
|
|
<LoadMoreButtonWrapper>
|
|
<LoadMoreButtonWrapper>
|