From 121d34455e41667b2ab0c1d266c48921a2c6f444 Mon Sep 17 00:00:00 2001 From: fdelemarre Date: Tue, 2 Jul 2024 10:33:34 +0200 Subject: [PATCH] add noop function --- src/webapp/components/table/BasicTable.tsx | 16 ++++------------ src/webapp/components/table/Cell.tsx | 4 +++- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/webapp/components/table/BasicTable.tsx b/src/webapp/components/table/BasicTable.tsx index dfbc1b23..b39eaf6b 100644 --- a/src/webapp/components/table/BasicTable.tsx +++ b/src/webapp/components/table/BasicTable.tsx @@ -1,11 +1,13 @@ import React from "react"; -import { Table, TableBody, TableCell, TableHead, TableRow, Link } from "@material-ui/core"; +import { Table, TableBody, TableCell, TableHead, TableRow } from "@material-ui/core"; import styled from "styled-components"; import { Maybe } from "../../../utils/ts-utils"; import i18n from "../../../utils/i18n"; import { SelectorOption } from "../selector/utils/selectorHelper"; import { Cell } from "./Cell"; +const noop = () => {}; + interface BaseColumn { value: string; label: string; @@ -33,7 +35,7 @@ interface BasicTableProps { } export const BasicTable: React.FC = React.memo( - ({ columns, rows, onChange = () => {}, showRowIndex = false }) => { + ({ columns, rows, onChange = noop, showRowIndex = false }) => { return ( @@ -92,13 +94,3 @@ const IndexTableCell = styled(TableCell)` padding-inline: 0.375rem; text-align: center; `; - -const StyledTableCell = styled(TableCell)<{ $underline?: boolean }>` - ${props => props.$underline && "text-decoration: underline;"} -`; - -const StyledLink = styled(Link)` - color: ${props => props.theme.palette.common.blue600}; - text-decoration: underline; - cursor: pointer; -`; diff --git a/src/webapp/components/table/Cell.tsx b/src/webapp/components/table/Cell.tsx index 9e7ba015..d1e287b6 100644 --- a/src/webapp/components/table/Cell.tsx +++ b/src/webapp/components/table/Cell.tsx @@ -4,6 +4,8 @@ import styled from "styled-components"; import { Selector } from "../selector/Selector"; import { TableColumn } from "./BasicTable"; +const noop = () => {}; + type CellProps = { value: string; rowIndex: number; @@ -12,7 +14,7 @@ type CellProps = { }; export const Cell: React.FC = React.memo( - ({ value, rowIndex, column, onChange = () => {} }) => { + ({ value, rowIndex, column, onChange = noop }) => { const [selectorValue, setSelectorValue] = React.useState(value); const handleChange = (value: string) => { setSelectorValue(value);