ohif-viewer/platform/ui/src/components/TableCell/TableCell.jsx

64 lines
1.2 KiB
React
Raw Normal View History

2020-03-20 22:56:27 +01:00
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
2020-03-23 19:04:44 +01:00
const TableCell = ({
children,
className,
isTableHead,
size,
align,
style,
}) => {
const classes = {
align: {
left: 'text-left',
center: 'text-center',
right: 'text-right',
justify: 'text-justify',
},
size: {
small: 'flex-0.3',
normal: 'flex-1',
},
2020-03-25 22:14:43 +01:00
isTableHead: {
true: '',
false: 'border-r border-custom-violetPale',
},
2020-03-20 22:56:27 +01:00
};
return (
<div
className={classnames(
'px-2 last:border-r-0 break-all',
2020-03-23 19:04:44 +01:00
classes.size[size],
classes.align[align],
2020-03-25 22:14:43 +01:00
classes.isTableHead[isTableHead],
2020-03-20 22:56:27 +01:00
className
)}
style={style}
>
{children}
</div>
);
};
TableCell.defaultProps = {
className: '',
isTableHead: false,
size: 'normal',
style: {},
2020-03-23 19:04:44 +01:00
align: 'left',
2020-03-20 22:56:27 +01:00
};
TableCell.propTypes = {
isTableHead: PropTypes.bool,
children: PropTypes.node.isRequired,
className: PropTypes.string,
size: PropTypes.oneOf(['small', 'normal']),
style: PropTypes.object,
2020-03-23 19:04:44 +01:00
align: PropTypes.oneOf(['left', 'center', 'right', 'justify']),
2020-03-20 22:56:27 +01:00
};
export default TableCell;