Commit 2c927051 authored by Omar Luna Hernández's avatar Omar Luna Hernández
Browse files

Se crea el componente y los estilos para la tabla que muestra los pueblos

parent bc1f96d5
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
.town_list_table {
  height: 100%;
}

.bhFeAR{
  display: flex !important;
  height: 100%;
} 

.rdt_TableBody{
  max-height: 100%;
  overflow-y: auto;
}
 No newline at end of file
+37 −0
Original line number Diff line number Diff line
import { Dispatch, SetStateAction, useEffect } from "react";
import { Town } from "../../../../infraestructure/entities/town";
import "./assets/css/styles.css";
import DataTable, { TableColumn } from "react-data-table-component";

interface props {
  towns: Town[];
  setIsLoading: Dispatch<SetStateAction<boolean>>;
}

export const TownListTable= ({towns, setIsLoading}: props) => {
  const columns : TableColumn<Town>[] = [
    {
      name: "Identificador", 
      selector: row => row.idTown
    },
    {
      name: "Nombre", 
      selector: row => row.name,
      sortable: true
    }, 
    {
      name: "Estado", 
      selector: row => row.state
    }
  ];

  useEffect(() => {
    setIsLoading(false);
  }, []);

  return (
    <div>
      <DataTable columns={columns} data={towns} selectableRows className="town_list_table"/>
    </div>
  );
}
 No newline at end of file