Files
Flowise/packages/ui/src/ui-component/table/Table.jsx
T
Greg L 3139152cb1 Merge branch 'main' of https://github.com/use-the-fork/Flowise into maintenance/pnpm-vite-jsx
# Conflicts:
#	packages/ui/src/views/canvas/index.jsx
#	packages/ui/src/views/chatflows/APICodeDialog.jsx
#	packages/ui/src/views/chatmessage/ChatMessage.jsx
2023-11-23 18:35:39 -05:00

36 lines
1.3 KiB
React

import PropTypes from 'prop-types'
import { TableContainer, Table, TableHead, TableCell, TableRow, TableBody, Paper } from '@mui/material'
export const TableViewOnly = ({ columns, rows, sx }) => {
return (
<>
<TableContainer component={Paper}>
<Table sx={{ minWidth: 650, ...sx }} aria-label='simple table'>
<TableHead>
<TableRow>
{columns.map((col, index) => (
<TableCell key={index}>{col.charAt(0).toUpperCase() + col.slice(1)}</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.map((row, index) => (
<TableRow key={index} sx={{ '&:last-child td, &:last-child th': { border: 0 } }}>
{Object.keys(row).map((key, index) => (
<TableCell key={index}>{row[key]}</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</>
)
}
TableViewOnly.propTypes = {
rows: PropTypes.array,
columns: PropTypes.array,
sx: PropTypes.object
}