Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3659 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3659 Rev 3665
Línea 1... Línea 1...
1
import React, { useCallback } from 'react';
1
import React from 'react';
Línea 2... Línea 2...
2
 
2
 
3
import { List } from '..';
3
import { List } from '..';
Línea 4... Línea 4...
4
import { CommentItem } from './CommentItem';
4
import { CommentItem } from './CommentItem';
5
 
-
 
6
export function CommentList({ comments = [], onDelete, onReport }) {
-
 
7
  const handleDelete = useCallback(
-
 
8
    (url, uuid) => {
-
 
9
      if (!url || !uuid) return;
-
 
10
      onDelete(url, uuid);
-
 
11
    },
-
 
12
    [onDelete]
-
 
13
  );
-
 
14
 
-
 
15
  const handleReport = useCallback(
-
 
16
    (url) => {
-
 
17
      if (!url) return;
-
 
18
      onReport(url);
-
 
19
    },
-
 
20
    [onReport]
-
 
21
  );
5
 
22
 
6
export function CommentList({ comments = [], onDelete, onReport }) {
23
  return (
7
  return (
24
    <List
8
    <List
25
      items={comments}
9
      items={comments}
26
      renderItem={(comment) => (
10
      renderItem={(comment) => (
27
        <CommentItem
11
        <CommentItem
28
          comment={comment}
-
 
29
          onDelete={comment.link_delete ? () => handleDelete(comment.link_delete) : null}
12
          comment={comment}
30
          onReport={
-
 
31
            comment.link_abuse_report ? () => handleReport(comment.link_abuse_report) : null
13
          onDelete={comment.link_delete ? () => onDelete(comment.link_delete) : null}
32
          }
14
          onReport={comment.link_abuse_report ? () => onReport(comment.link_abuse_report) : null}
33
        />
15
        />
34
      )}
16
      )}
35
      emptyMessage='No hay comentarios para mostrar'
17
      emptyMessage='No hay comentarios para mostrar'