Skip to content

Commit

Permalink
add noop function
Browse files Browse the repository at this point in the history
  • Loading branch information
fdelemarre committed Jul 2, 2024
1 parent 808c876 commit 121d344
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
16 changes: 4 additions & 12 deletions src/webapp/components/table/BasicTable.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -33,7 +35,7 @@ interface BasicTableProps {
}

export const BasicTable: React.FC<BasicTableProps> = React.memo(
({ columns, rows, onChange = () => {}, showRowIndex = false }) => {
({ columns, rows, onChange = noop, showRowIndex = false }) => {
return (
<StyledTable stickyHeader>
<TableHead>
Expand Down Expand Up @@ -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;
`;
4 changes: 3 additions & 1 deletion src/webapp/components/table/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -12,7 +14,7 @@ type CellProps = {
};

export const Cell: React.FC<CellProps> = React.memo(
({ value, rowIndex, column, onChange = () => {} }) => {
({ value, rowIndex, column, onChange = noop }) => {
const [selectorValue, setSelectorValue] = React.useState<string>(value);
const handleChange = (value: string) => {
setSelectorValue(value);
Expand Down

0 comments on commit 121d344

Please sign in to comment.