File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { ReactNode } from 'react'
1+ import React , { ReactNode } from 'react'
22import { Placeholder } from 'src/components/placeholders'
33import { MAX_ITEMS_PER_CARD } from 'src/config'
44import { CarbonAd } from 'src/features/carbonAds'
55import { BaseEntry } from 'src/types'
66
7+ type PlaceholdersProps = {
8+ placeholder : ReactNode
9+ }
10+
11+ const Placeholders = React . memo < PlaceholdersProps > ( ( { placeholder } ) => {
12+ return (
13+ < >
14+ { [ ...Array ( 7 ) ] . map ( ( x , i ) => (
15+ < span key = { i } > { placeholder } </ span >
16+ ) ) }
17+ </ >
18+ )
19+ } )
20+
721export type ListComponentPropsType < T extends BaseEntry > = {
822 items : T [ ]
923 isLoading : boolean
@@ -44,15 +58,5 @@ export function ListComponent<T extends BaseEntry>(props: ListComponentPropsType
4458 } )
4559 }
4660
47- function Placeholders ( ) {
48- return (
49- < >
50- { [ ...Array ( 7 ) ] . map ( ( x , i ) => (
51- < span key = { i } > { placeholder } </ span >
52- ) ) }
53- </ >
54- )
55- }
56-
57- return < > { isLoading ? < Placeholders /> : renderItems ( ) } </ >
61+ return < > { isLoading ? < Placeholders placeholder = { placeholder } /> : renderItems ( ) } </ >
5862}
You can’t perform that action at this time.
0 commit comments