Added styling to the labels.
This commit is contained in:
1 parent
b254c9058e
commit
d954b58766
2 files changed
+11
-7
No files matched your search
@@ -124,7 +124,7 @@ ColoredLabel.propTypes = {
|
|||||||
* <StatusLabel status="Active" />
|
* <StatusLabel status="Active" />
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const StatusLabel = ({ status }) => {
|
const StatusLabel = ({ status, customStyles }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const colorLookup = {
|
const colorLookup = {
|
||||||
@@ -132,13 +132,15 @@ const StatusLabel = ({ status }) => {
|
|||||||
Waiting: theme.palette.labelRed.color,
|
Waiting: theme.palette.labelRed.color,
|
||||||
New: theme.palette.labelOrange.color,
|
New: theme.palette.labelOrange.color,
|
||||||
Active: theme.palette.labelGreen.color,
|
Active: theme.palette.labelGreen.color,
|
||||||
|
Down: theme.palette.error.main, // Assuming theme.palette.error.main is red
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Look up the color for the status, default to labelGray if not found
|
// Look up the color for the status, default to labelGray if not found
|
||||||
const color = colorLookup[status] || theme.palette.labelGray.color;
|
const color = colorLookup[status] || theme.palette.labelGray.color;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseLabel label={status}>
|
<BaseLabel label={status} styles={customStyles}>
|
||||||
<Box
|
<Box
|
||||||
width={12}
|
width={12}
|
||||||
height={12}
|
height={12}
|
||||||
@@ -152,6 +154,7 @@ const StatusLabel = ({ status }) => {
|
|||||||
|
|
||||||
StatusLabel.propTypes = {
|
StatusLabel.propTypes = {
|
||||||
status: PropTypes.oneOf(["Seen", "Waiting", "New", "Active"]),
|
status: PropTypes.oneOf(["Seen", "Waiting", "New", "Active"]),
|
||||||
|
customStyles: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
export { ColoredLabel, StatusLabel };
|
export { ColoredLabel, StatusLabel };
|
||||||
@@ -36,13 +36,14 @@ function createData(name, calories, fat, carbs, protein) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const rows = [
|
const rows = [
|
||||||
createData(<StatusLabel status="Down" />, '2024-03-14 21:41:09', 'HTTP 350 - NOK'),
|
createData(<StatusLabel status="Down" customStyles={{ backgroundColor: '#fff9f9', borderColor: '#ffcac6', color: '#344054' }} />, '2024-03-14 21:41:09', 'HTTP 350 - NOK'),
|
||||||
createData(<StatusLabel status="Down" />, '2024-03-14 21:41:09', 'timeout of 48000ms exceeded'),
|
createData(<StatusLabel status="Down" customStyles={{ backgroundColor: '#fff9f9', borderColor: '#ffcac6', color: '#344054' }} />, '2024-03-14 21:41:09', 'timeout of 48000ms exceeded'),
|
||||||
createData(<StatusLabel status="Down" />, '2024-03-14 21:41:09', 'timeout of 48000ms exceeded'),
|
createData(<StatusLabel status="Cannot resolve" customStyles={{ backgroundColor: '#f2f4f7', borderColor: '#d2d6de', color: '#344054' }} />, '2024-03-14 21:41:09', 'timeout of 48000ms exceeded'),
|
||||||
createData(<StatusLabel status="Cannot resolve" />, '2024-03-14 21:41:09', 'HTTP 350 - NOK'),
|
createData(<StatusLabel status="Cannot resolve" customStyles={{ backgroundColor: '#f2f4f7', borderColor: '#d2d6de', color: '#344054' }} />, '2024-03-14 21:41:09', 'timeout of 48000ms exceeded'),
|
||||||
createData(<StatusLabel status="Down" />, '2024-03-14 21:41:09', 'HTTP 350 - NOK'),
|
createData(<StatusLabel status="Down" customStyles={{ backgroundColor: '#fff9f9', borderColor: '#ffcac6', color: '#344054' }} />, '2024-03-14 21:41:09', 'HTTP 350 - NOK'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export default function CustomizedTables() {
|
export default function CustomizedTables() {
|
||||||
return (
|
return (
|
||||||
<TableContainer component={Paper}>
|
<TableContainer component={Paper}>
|
||||||
|
|||||||
Reference in new issue
Block a user