Added styling to basic table component
This commit is contained in:
1 parent
8cc83a4422
commit
b7e6e44b88
4 files changed
+161
-18
No files matched your search
@@ -0,0 +1,118 @@
|
|||||||
|
.MuiTable-root .host-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MuiTable-root .host-row a {
|
||||||
|
width: var(--env-var-img-width-2);
|
||||||
|
height: var(--env-var-img-width-2);
|
||||||
|
color: var(--env-var-color-5);
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
.MuiTable-root .host-row a svg {
|
||||||
|
width: var(--env-var-font-size-large);
|
||||||
|
height: var(--env-var-font-size-large);
|
||||||
|
}
|
||||||
|
.MuiTable-root .host-row .host-percentage {
|
||||||
|
font-size: var(--env-var-font-size-small);
|
||||||
|
}
|
||||||
|
|
||||||
|
.MuiTable-root .host-name {
|
||||||
|
width: fit-content;
|
||||||
|
margin-right: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MuiPaper-root:has(table.MuiTable-root) {
|
||||||
|
box-shadow: none;
|
||||||
|
border: solid 1px var(--env-var-color-16);
|
||||||
|
border-radius: var(--env-var-radius-1);
|
||||||
|
}
|
||||||
|
.MuiTable-root
|
||||||
|
.MuiTableBody-root
|
||||||
|
.MuiTableRow-root:last-child
|
||||||
|
.MuiTableCell-root {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.MuiTable-root .MuiTableHead-root,
|
||||||
|
.MuiTable-root .MuiTableRow-root:hover {
|
||||||
|
background-color: var(--env-var-color-13);
|
||||||
|
}
|
||||||
|
.MuiTable-root .MuiTableHead-root .MuiTableCell-root,
|
||||||
|
.MuiTable-root .MuiTableBody-root .MuiTableCell-root {
|
||||||
|
font-size: var(--env-var-font-size-medium);
|
||||||
|
}
|
||||||
|
.MuiTable-root .MuiTableHead-root .MuiTableCell-root {
|
||||||
|
padding: var(--env-var-spacing-1) var(--env-var-spacing-2);
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--env-var-color-2);
|
||||||
|
}
|
||||||
|
.MuiTable-root .MuiTableHead-root span {
|
||||||
|
display: inline-block;
|
||||||
|
height: 17px;
|
||||||
|
width: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: -3px;
|
||||||
|
margin-left: 3px;
|
||||||
|
}
|
||||||
|
.MuiTable-root .MuiTableHead-root span svg {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
.MuiTable-root .MuiTableBody-root .MuiTableCell-root {
|
||||||
|
color: var(--env-var-color-5);
|
||||||
|
padding: 6px var(--env-var-spacing-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.MuiPaper-root + .MuiPagination-root {
|
||||||
|
flex: 1;
|
||||||
|
margin-top: 35px;
|
||||||
|
border: solid 1px var(--env-var-color-16);
|
||||||
|
border-radius: var(--env-var-radius-1);
|
||||||
|
padding: var(--env-var-spacing-1-plus) var(--env-var-spacing-2);
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li button {
|
||||||
|
font-size: var(--env-var-font-size-medium);
|
||||||
|
color: var(--env-var-color-5);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:first-child {
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:last-child {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:first-child button,
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:last-child button {
|
||||||
|
border: solid 1px var(--env-var-color-16);
|
||||||
|
border-radius: var(--env-var-radius-1);
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:first-child button {
|
||||||
|
padding: 0 var(--env-var-spacing-1) 0 var(--env-var-spacing-1-plus);
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:last-child button {
|
||||||
|
padding: 0 var(--env-var-spacing-1-plus) 0 var(--env-var-spacing-1);
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:first-child button::after,
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:last-child button::before {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:first-child button::after {
|
||||||
|
content: "Previous";
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root ul li:last-child button::before {
|
||||||
|
content: "Next";
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
.MuiPaper-root + .MuiPagination-root .MuiPaginationItem-root.Mui-selected {
|
||||||
|
background-color: var(--env-var-color-15);
|
||||||
|
}
|
||||||
@@ -6,10 +6,14 @@ import {
|
|||||||
TableRow,
|
TableRow,
|
||||||
TableCell,
|
TableCell,
|
||||||
TableBody,
|
TableBody,
|
||||||
TablePagination,
|
Pagination,
|
||||||
|
PaginationItem,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
import "./index.css";
|
||||||
|
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
||||||
|
import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BasicTable Component
|
* BasicTable Component
|
||||||
@@ -66,17 +70,12 @@ const BasicTable = ({ data, paginated }) => {
|
|||||||
// Add headers to props validation
|
// Add headers to props validation
|
||||||
|
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
const [rowsPerPage, setRowsPerPage] = useState(5);
|
const rowsPerPage = 5;
|
||||||
|
|
||||||
const handleChangePage = (event, newPage) => {
|
const handleChangePage = (event, newPage) => {
|
||||||
setPage(newPage);
|
setPage(newPage);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChangeRowsPerPage = (event) => {
|
|
||||||
setRowsPerPage(parseInt(event.target.value, 10));
|
|
||||||
setPage(0); // Reset to first page after changing rows per page
|
|
||||||
};
|
|
||||||
|
|
||||||
let displayData = [];
|
let displayData = [];
|
||||||
|
|
||||||
if (data && data.rows) {
|
if (data && data.rows) {
|
||||||
@@ -118,14 +117,29 @@ const BasicTable = ({ data, paginated }) => {
|
|||||||
</Table>
|
</Table>
|
||||||
</TableContainer>
|
</TableContainer>
|
||||||
{paginated === true && (
|
{paginated === true && (
|
||||||
<TablePagination
|
<Pagination
|
||||||
rowsPerPageOptions={[1, 5, 10, 25]}
|
count={Math.ceil(data.rows.length / rowsPerPage)}
|
||||||
component="div"
|
page={page + 1}
|
||||||
count={data.rows.length}
|
onChange={(event, value) => handleChangePage(event, value - 1)}
|
||||||
rowsPerPage={rowsPerPage}
|
shape="rounded"
|
||||||
page={page}
|
renderItem={(item) => (
|
||||||
onPageChange={handleChangePage}
|
<PaginationItem
|
||||||
onRowsPerPageChange={handleChangeRowsPerPage}
|
slots={{
|
||||||
|
previous: ArrowBackRoundedIcon,
|
||||||
|
next: ArrowForwardRoundedIcon,
|
||||||
|
}}
|
||||||
|
{...item}
|
||||||
|
sx={{
|
||||||
|
"&:focus": {
|
||||||
|
outline: "none",
|
||||||
|
},
|
||||||
|
"& .MuiTouchRipple-root": {
|
||||||
|
pointerEvents: "none",
|
||||||
|
display: "none",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.host-row {
|
/* .host-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@@ -109,4 +109,4 @@
|
|||||||
.monitors .MuiPagination-root ul li:last-child button::before {
|
.monitors .MuiPagination-root ul li:last-child button::before {
|
||||||
content: "Next";
|
content: "Next";
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
}
|
} */
|
||||||
@@ -5,6 +5,7 @@ import BasicTable from "../BasicTable";
|
|||||||
import OpenInNewPage from "../../assets/icons/open-in-new-page.svg?react";
|
import OpenInNewPage from "../../assets/icons/open-in-new-page.svg?react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import StatusLabel from "../StatusLabel";
|
import StatusLabel from "../StatusLabel";
|
||||||
|
import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Host component.
|
* Host component.
|
||||||
@@ -54,7 +55,17 @@ const MonitorTable = ({ monitors = [] }) => {
|
|||||||
const data = {
|
const data = {
|
||||||
cols: [
|
cols: [
|
||||||
{ id: 1, name: "Host" },
|
{ id: 1, name: "Host" },
|
||||||
{ id: 2, name: "Status" },
|
{
|
||||||
|
id: 2,
|
||||||
|
name: (
|
||||||
|
<>
|
||||||
|
Status
|
||||||
|
<span>
|
||||||
|
<ArrowDownwardRoundedIcon />
|
||||||
|
</span>
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ id: 3, name: "Response Time" },
|
{ id: 3, name: "Response Time" },
|
||||||
{ id: 4, name: "Actions" },
|
{ id: 4, name: "Actions" },
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user