fixed header column spacing issues
This commit is contained in:
parent
441223d85e
commit
6234f13eb0
1 changed files with 49 additions and 39 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Box, CircularProgress, Collapse, darken, IconButton, InputAdornment, Paper, SxProps, Table, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TextField, Theme, Typography } from "@mui/material";
|
||||
import { Box, CircularProgress, Collapse, darken, Grid2, IconButton, InputAdornment, Paper, SxProps, Table, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TextField, Theme, Typography } from "@mui/material";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import { ChevronRight, Close, Search } from "@mui/icons-material"
|
||||
import { useEffect, useState } from "react";
|
||||
|
|
@ -122,30 +122,8 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
|||
setInputSearchText("")
|
||||
}
|
||||
|
||||
if (isMobile) return (
|
||||
<Typography>
|
||||
Hello!
|
||||
</Typography>
|
||||
)
|
||||
|
||||
const searchBar = () => {
|
||||
return (
|
||||
<TableContainer className={classes.tableContainer} component={Paper}>
|
||||
<Table>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
{title && <TableCell colSpan={2} className={classes.titleContainer}>
|
||||
{typeof(title) === "string" ?
|
||||
<Typography variant="h5" className={classes.title}>
|
||||
{title}
|
||||
</Typography>
|
||||
:
|
||||
<Box className={classes.title}>
|
||||
title
|
||||
</Box>
|
||||
}
|
||||
</TableCell>}
|
||||
{ setSearchText &&
|
||||
<TableCell colSpan={title ? columns ? 4 : 2 : 6} className={classes.searchContainer}>
|
||||
<TextField
|
||||
variant="standard"
|
||||
placeholder="Search..."
|
||||
|
|
@ -168,8 +146,40 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
|||
),
|
||||
}}
|
||||
/>
|
||||
</TableCell>
|
||||
)
|
||||
}
|
||||
|
||||
if (isMobile) return (
|
||||
<Typography>
|
||||
Hello!
|
||||
</Typography>
|
||||
)
|
||||
|
||||
return (
|
||||
<TableContainer className={classes.tableContainer} component={Paper}>
|
||||
<Table>
|
||||
<TableHead>
|
||||
<TableRow sx={ !title && !setSearchText ? { display: "none" } : undefined}>
|
||||
<TableCell colSpan={10000} sx={{ border: "none" }}>
|
||||
<Grid2 container justifyContent="space-between">
|
||||
<Grid2>
|
||||
{typeof(title) === "string" ?
|
||||
<Typography variant="h5" className={classes.title}>
|
||||
{title}
|
||||
</Typography>
|
||||
:
|
||||
title && <Box className={classes.title}>
|
||||
title
|
||||
</Box>
|
||||
}
|
||||
</Grid2>
|
||||
<Grid2>
|
||||
{setSearchText &&<Box className={classes.searchContainer}>
|
||||
{searchBar()}
|
||||
</Box>}
|
||||
</Grid2>
|
||||
</Grid2>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
{ renderGutter && <TableCell></TableCell>}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue