|
@@ -7,17 +7,18 @@ import {
|
|
|
GetVideosConnectionQueryVariables,
|
|
|
VideoWhereInput,
|
|
|
} 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 { SentryLogger } from '@/utils/logs'
|
|
|
|
|
|
-import { AdditionalLink, LoadMoreButtonWrapper, TitleWrapper } from './InfiniteGrid.style'
|
|
|
+import { AdditionalLink, LoadMoreButtonWrapper } from './InfiniteGrid.style'
|
|
|
import { useInfiniteGrid } from './useInfiniteGrid'
|
|
|
|
|
|
import { VideoTile } from '../VideoTile'
|
|
|
|
|
|
type InfiniteVideoGridProps = {
|
|
|
title?: string
|
|
|
+ titleLoader?: boolean
|
|
|
categoryId?: string
|
|
|
channelId?: string
|
|
|
channelIdIn?: string[] | null
|
|
@@ -62,6 +63,7 @@ export const InfiniteVideoGrid: React.FC<InfiniteVideoGridProps> = ({
|
|
|
onDemand = false,
|
|
|
additionalLink,
|
|
|
isFeatured = false,
|
|
|
+ titleLoader,
|
|
|
}) => {
|
|
|
const [videosPerRow, setVideosPerRow] = useState(INITIAL_VIDEOS_PER_ROW)
|
|
|
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
|
|
|
return (
|
|
|
<section className={className}>
|
|
|
- <TitleWrapper>
|
|
|
+ <GridHeadingContainer>
|
|
|
{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
|
|
|
to={additionalLink.url}
|
|
@@ -187,9 +193,9 @@ export const InfiniteVideoGrid: React.FC<InfiniteVideoGridProps> = ({
|
|
|
{additionalLink.name}
|
|
|
</AdditionalLink>
|
|
|
)}
|
|
|
- </GridHeadingContainer>
|
|
|
+ </TitleContainer>
|
|
|
)}
|
|
|
- </TitleWrapper>
|
|
|
+ </GridHeadingContainer>
|
|
|
<Grid onResize={(sizes) => setVideosPerRow(sizes.length)}>{gridContent}</Grid>
|
|
|
{shouldShowLoadMoreButton && (
|
|
|
<LoadMoreButtonWrapper>
|