[refactor,#59][s]: move packages/portal => examples/catalog as per plan in #59.
What is currently packages/portal is example of a running portal and should move to examples (it will get replaced by an actual portal lib soon).
This commit is contained in:
36
examples/catalog/components/_shared/Table.tsx
Normal file
36
examples/catalog/components/_shared/Table.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
interface TableProps {
|
||||
columns: Array<any>;
|
||||
data: Array<any>;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const Table: React.FC<TableProps> = ({ columns, data, className }) => {
|
||||
return (
|
||||
<table className={`table-auto w-full text-sm text-left my-6 ${className}`}>
|
||||
<thead>
|
||||
<tr>
|
||||
{columns.map(({ key, name }) => (
|
||||
<th key={key} className="px-4 py-2">
|
||||
{name}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{data.map((item) => (
|
||||
<tr key={item.id}>
|
||||
{columns.map(({ key, render }) => (
|
||||
<td key={key} className="px-4 py-2">
|
||||
{(render && typeof render === 'function' && render(item)) ||
|
||||
item[key] ||
|
||||
''}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
};
|
||||
|
||||
export default Table;
|
||||
Reference in New Issue
Block a user