File size: 1,272 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { useTranslate } from 'i18n-calypso';
import { VirtualizedList } from '../virtualized-list';
import CommentRow from './comment-row';
import type { PostSubscription } from '@automattic/data-stores/src/reader/types';
import './styles.scss';

type CommentListProps = {
	posts?: PostSubscription[];
};

const CommentList = ( { posts }: CommentListProps ) => {
	const translate = useTranslate();

	return (
		<div className="subscription-manager__comment-list" role="table">
			<div className="row-wrapper header">
				<div className="row header" role="row">
					<span className="post" role="columnheader">
						{ translate( 'Subscribed post' ) }
					</span>
					<span className="title-box" role="columnheader">
						{ translate( 'Site' ) }
					</span>
					<span className="date" role="columnheader">
						{ translate( 'Since' ) }
					</span>
					<span className="actions" role="columnheader" />
				</div>
			</div>

			{ posts ? (
				<VirtualizedList items={ posts }>
					{ ( { item, key, style, registerChild } ) => (
						<CommentRow
							key={ `${ item.id }-${ key }` }
							style={ style }
							forwardedRef={ registerChild }
							{ ...item }
						/>
					) }
				</VirtualizedList>
			) : null }
		</div>
	);
};

export default CommentList;