CEC-3348: truncate table cell (#467)

* CEC-3348: truncate ecu list

* calc string once

* remove unused dep
This commit is contained in:
Tristan Timblin
2023-10-23 12:55:13 -07:00
committed by GitHub
parent 2a71d87c93
commit a0da4271a1
2 changed files with 29 additions and 6 deletions

View File

@@ -275,7 +275,12 @@ exports[`Suppliers page Render 1`] = `
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >
ADAS <span
class="makeStyles-truncateCell-0"
title="ADAS"
>
ADAS
</span>
</td> </td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
@@ -326,7 +331,12 @@ exports[`Suppliers page Render 1`] = `
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >
ICC, BCM <span
class="makeStyles-truncateCell-0"
title="ICC, BCM"
>
ICC, BCM
</span>
</td> </td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
@@ -377,7 +387,12 @@ exports[`Suppliers page Render 1`] = `
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >
BCM <span
class="makeStyles-truncateCell-0"
title="BCM"
>
BCM
</span>
</td> </td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
@@ -403,7 +418,7 @@ exports[`Suppliers page Render 1`] = `
> >
<td <td
class="MuiTableCell-root MuiTableCell-footer MuiTablePagination-root" class="MuiTableCell-root MuiTableCell-footer MuiTablePagination-root"
colspan="7" colspan="9"
> >
<div <div
class="MuiToolbar-root MuiToolbar-regular MuiTablePagination-toolbar MuiToolbar-gutters" class="MuiToolbar-root MuiToolbar-regular MuiTablePagination-toolbar MuiToolbar-gutters"

View File

@@ -8,6 +8,7 @@ import {
TableFooter, TableFooter,
TablePagination, TablePagination,
TableRow, TableRow,
Tooltip,
} from "@material-ui/core"; } from "@material-ui/core";
import clsx from "clsx"; import clsx from "clsx";
@@ -128,6 +129,7 @@ const SupplierTable = (props) => {
/> />
<TableBody> <TableBody>
{suppliers.map((row, index) => { {suppliers.map((row, index) => {
const ecuList = row.ecus.join(", ");
return ( return (
<TableRow key={index}> <TableRow key={index}>
<TableCell align="center"> <TableCell align="center">
@@ -138,7 +140,13 @@ const SupplierTable = (props) => {
<a href={`mailto:${row.email}`}>{row.email}</a> <a href={`mailto:${row.email}`}>{row.email}</a>
</TableCell> </TableCell>
<TableCell align="center">{row.program}</TableCell> <TableCell align="center">{row.program}</TableCell>
<TableCell align="center">{row.ecus.join(", ")}</TableCell> <TableCell align="center">
<Tooltip title={ecuList}>
<span className={classes.truncateCell}>
{ecuList}
</span>
</Tooltip>
</TableCell>
<TableCell align="center"> <TableCell align="center">
{LocalDateTimeString(row.created)} {LocalDateTimeString(row.created)}
</TableCell> </TableCell>
@@ -159,7 +167,7 @@ const SupplierTable = (props) => {
<TableRow> <TableRow>
<TablePagination <TablePagination
rowsPerPageOptions={[5, 10, 25, 100]} rowsPerPageOptions={[5, 10, 25, 100]}
colSpan={7} colSpan={9}
count={totalSuppliers} count={totalSuppliers}
rowsPerPage={pageSize} rowsPerPage={pageSize}
page={pageIndex} page={pageIndex}