diff --git a/src/components/Shared/Table.js b/src/components/Shared/Table.js index 45e45e6..70a4098 100644 --- a/src/components/Shared/Table.js +++ b/src/components/Shared/Table.js @@ -1,56 +1,85 @@ import React from "react"; -import { Table, Thead, Tbody, Tr, Th, Td } from "react-super-responsive-table" -import "./Table.css" +import { Table, Thead, Tbody, Tr, Th, Td } from "react-super-responsive-table"; +import "./Table.css"; import "react-super-responsive-table/dist/SuperResponsiveTableStyle.css"; -export const CreateTable = (data, columns, deleteFunction, editFunction, sting) => ( +export const CreateTable = ( + data, + columns, + deleteFunction, + editFunction, + sting +) => (
{x} | )} - {(deleteFunction || editFunction) - ? ( -actions | - ) - : null} + {columns.map((x) => ( +{x} | + ))} + {deleteFunction || editFunction ?actions | : null}||
---|---|---|---|---|---|
{value} | ) - } - } - catch { } - return ( -{value ? value : '\u00A0'} | - ) - })} - {(deleteFunction || editFunction || sting) - ? (
- {deleteFunction
- ? ( deleteFunction(item["_id"]).then(() => {
- if (window) {
- window.location.reload();
+ {[]
+ .concat(data)
+ .sort((a, b) => (a.placement[0] > b.placement[0] ? 1 : -1))
+ .map((item, index) => {
+ return (
+
+
+ {value}
+
+ |
+ );
}
- })}>Delete)
- : null}
- {editFunction
- ? ( editFunction(item)}>Edit)
- : null}
- {sting
- ? ( sting(item["_id"])}>Sting)
- : null}
- )
- : null}
- | + {value ? value : "\u00A0"} + | + ); + })} + {deleteFunction || editFunction || sting ? ( ++ {deleteFunction ? ( + + deleteFunction(item["_id"]).then(() => { + if (window) { + window.location.reload(); + } + }) + } + > + Delete + + ) : null} + {editFunction ? ( + editFunction(item)}> + Edit + + ) : null} + {sting ? ( + sting(item["_id"])}> + Sting + + ) : null} + | + ) : null} +