import Card from '@mui/material/Card'
import CardContent from '@mui/material/CardContent'
import classnames from 'classnames'
import React from 'react'
import { Link } from '../buttons'
import styles from './Table.module.css'
const Table = ({ children, className, ...props }) => (
{children}
)
const THead = ({ children, className }) => {
return {children}
}
const TDoubleLevelHead = ({ children, className }) => {
return (
{children}
)
}
const TBody = ({ children, className }) => {
return {children}
}
const Td = ({
style = {},
children,
header,
className,
width = 100,
size,
bold,
textAlign,
action,
}) => {
const inlineStyle = {
...style,
width,
textAlign,
fontSize: size === 'sm' ? '14px' : size === 'lg' ? '24px' : '',
}
const cssClasses = {
[styles.td]: !header,
[styles.tdHeader]: header,
'font-bold': !header && (bold || size === 'lg'),
[styles.actionCol]: action,
}
return (
{children}
)
}
const Th = ({ children, ...props }) => {
return (
{children}
|
)
}
const ThDoubleLevel = ({ title, children, className, width }) => {
return (
)
}
const Tr = ({
onClick,
error,
errorMessage,
shouldShowError,
children,
className,
size,
newRow,
}) => {
const inlineStyle = {
minHeight: size === 'sm' ? '34px' : size === 'lg' ? '68px' : '48px',
}
const cardClasses = {
[styles.card]: true,
[styles.trError]: error,
[styles.trAdding]: newRow,
}
const mainContentClasses = {
[styles.mainContent]: true,
[styles.sizeSm]: size === 'sm',
[styles.sizeLg]: size === 'lg',
}
return (
<>
{children}
{error && shouldShowError && (
{errorMessage}
)}
>
)
}
const EditCell = ({ save, cancel }) => (
Cancel
Save
|
)
export {
Table,
THead,
TDoubleLevelHead,
TBody,
Tr,
Td,
Th,
ThDoubleLevel,
EditCell,
}