Commit 699a1060 authored by Shiva Komirishetti's avatar Shiva Komirishetti

Table and toast changes

parent 2c444030
...@@ -64,28 +64,28 @@ function Table({headers, data,loading, handleSorting }) { ...@@ -64,28 +64,28 @@ function Table({headers, data,loading, handleSorting }) {
<thead className=" uppercase bg-white font-extrabold"> <thead className=" uppercase bg-white font-extrabold">
<tr className="mb-2 border-2 border-black-200"> <tr className="mb-2 border-2 border-black-200">
{headers?.map((item,index) => ( {headers?.map((item,index) => (
<th key={index} scope="col" className={`px-6 py-4 w-[${item.width}]`} > !item?.hide && (<th key={index} scope="col" className={`px-6 py-4 w-[${item.width}]`} >
{ item.renderHeader ? item.renderHeader(item.title) : item.isSorting ? {item.isSorting ?
<span className="flex items-center"> <span className="flex items-center">
<span className="mr-4">{item.title}</span> <span className="mr-4">{item.title}</span>
<SortButton selected={item.id === sortKey ? sortOrder : ''} handleClick={() =>handleSort(item.id)}/> <SortButton selected={item.id === sortKey ? sortOrder : ''} handleClick={() =>handleSort(item.id)}/>
</span> : </span> :
<span>{item.title}</span> <span>{item.title}</span>
} }
</th> </th>)
))} ))}
</tr> </tr>
</thead> </thead>
{ {
(data?.length)?<tbody > (data?.length && !loading)?<tbody >
{ {
data?.map((item, index) => ( data?.map((item, index) => (
<tr key={item.id} className="bg-[#eef5ff] font-medium hover:bg-white " > <tr key={item.id} className="bg-[#eef5ff] font-medium hover:bg-white " >
{ {
headers?.map(({render, id}) => ( headers?.map(({render, id, hide}) => (
<td className="px-6 py-2 capitalize" > !hide && (<td className="px-6 py-2 capitalize" >
{render ? render(item[id]) : item[id] === "" ? "NA" : item[id] } {render ? render(item[id], item) : item[id] === "" ? "NA" : item[id]}
</td> </td>)
)) ))
} }
</tr> </tr>
......
...@@ -2,8 +2,10 @@ import React, { useState } from 'react'; ...@@ -2,8 +2,10 @@ import React, { useState } from 'react';
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
import Header from '../../components/header'; import Header from '../../components/header';
import Sidebar from '../../components/sidebar'; import Sidebar from '../../components/sidebar';
import { ToastContainer } from 'react-toastify';
import LeftSidebar from '../../components/leftSidebar'; import LeftSidebar from '../../components/leftSidebar';
import SetWindowSize from '../../utils/SetWindowSize'; import SetWindowSize from '../../utils/SetWindowSize';
import 'react-toastify/dist/ReactToastify.css';
function Layout({children}) { function Layout({children}) {
const location = useLocation(); const location = useLocation();
...@@ -24,6 +26,18 @@ function Layout({children}) { ...@@ -24,6 +26,18 @@ function Layout({children}) {
</div> </div>
{url.includes('/viewreportee') && <LeftSidebar/>} {url.includes('/viewreportee') && <LeftSidebar/>}
</div> </div>
<ToastContainer
position="bottom-center"
autoClose={4000}
hideProgressBar={true}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="light"
/>
</div> </div>
) )
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment