Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3543 Rev 3545
Línea 1... Línea 1...
1
import React from 'react';
1
import React, { useCallback } 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 CommentsList({ 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]
5
 
21
  );
6
export function CommentsList({ comments = [], onDelete, onReport }) {
22
 
7
  return (
23
  return (
8
    <List
24
    <List
9
      items={comments}
25
      items={comments}
10
      renderItem={(comment) => (
26
      renderItem={(comment) => (
11
        <CommentItem
27
        <CommentItem
12
          comment={comment}
28
          comment={comment}
13
          onDelete={
29
          onDelete={
14
            comment.link_delete ? onDelete.bind(null, comment.link_delete, comment.uuid) : null
30
            comment.link_delete ? () => handleDelete(comment.link_delete, comment.uuid) : null
15
          }
31
          }
16
          onReport={
32
          onReport={
17
            comment.link_abuse_report ? onReport.bind(null, comment.link_abuse_report) : null
33
            comment.link_abuse_report ? () => handleReport(comment.link_abuse_report) : null
18
          }
34
          }
19
        />
35
        />
20
      )}
36
      )}