-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy pathDataTableBodyCell.jsx
More file actions
59 lines (49 loc) · 1.6 KB
/
DataTableBodyCell.jsx
File metadata and controls
59 lines (49 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
=========================================================
* Material Dashboard 2 React - v2.2.0
=========================================================
* Product Page: https://www.creative-tim.com/product/material-dashboard-react
* Copyright 2023 Creative Tim (https://www.creative-tim.com)
Coded by www.creative-tim.com
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
// prop-types is a library for typechecking of props
import PropTypes from "prop-types";
// Material Dashboard 2 React components
import MDBox from "components/MDBox";
function DataTableBodyCell({ noBorder, align, children }) {
return (
<MDBox
component="td"
textAlign={align}
py={1.5}
px={3}
sx={({ palette: { light }, typography: { size }, borders: { borderWidth } }) => ({
fontSize: size.sm,
borderBottom: noBorder ? "none" : `${borderWidth[1]} solid ${light.main}`,
})}
>
<MDBox
display="inline-block"
width="max-content"
color="text"
sx={{ verticalAlign: "middle" }}
>
{children}
</MDBox>
</MDBox>
);
}
// Setting default values for the props of DataTableBodyCell
DataTableBodyCell.defaultProps = {
noBorder: false,
align: "left",
};
// Typechecking props for the DataTableBodyCell
DataTableBodyCell.propTypes = {
children: PropTypes.node.isRequired,
noBorder: PropTypes.bool,
align: PropTypes.oneOf(["left", "right", "center"]),
};
export default DataTableBodyCell;