"use client";
import { useState } from "react";
import ItemUser from "./ItemUser";

function Comment({ data }) {
  const [list, setList] = useState(data?.comments);
  const [update, setUpdate] = useState(false);

  return (
    <ul
      className={`flex flex-col comment-list !pl-2.5 justify-start max-h-[492px] overflow-auto items-start gap-12 mt-2 ${
        false && "w-full"
      }`}
    >
      {data &&
        !!data?.comments?.length &&
        data?.comments.map((item, idx) => (
          <ItemUser
            key={idx}
            list={list}
            data={item}
            update={update}
            setList={setList}
            setUpdate={setUpdate}
          />
        ))}
    </ul>
  );
}

export default Comment;
