Skip to content

Commit

Permalink
address != vs !==
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson authored Dec 3, 2024
1 parent e8f73fb commit cffd1b8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions website/src/components/SearchPage/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ type TableProps = {
columnsToShow: string[];
};

const getColumnWidthStyle = (columnWidth: number | undefined) =>
columnWidth !== null && columnWidth !== undefined ? `${columnWidth}px` : undefined;

Check failure on line 46 in website/src/components/SearchPage/Table.tsx

View workflow job for this annotation

GitHub Actions / format

Unnecessary conditional, the types have no overlap

Check failure on line 46 in website/src/components/SearchPage/Table.tsx

View workflow job for this annotation

GitHub Actions / Check format and types

Unnecessary conditional, the types have no overlap

export const Table: FC<TableProps> = ({
data,
schema,
Expand All @@ -66,6 +69,8 @@ export const Table: FC<TableProps> = ({
columnWidth: schema.metadata.find((m) => m.name === field)?.columnWidth,
}));



const handleSort = (field: string) => {
if (orderBy.field === field) {
if (orderBy.type === 'ascending') {
Expand Down Expand Up @@ -147,7 +152,7 @@ export const Table: FC<TableProps> = ({
onClick={() => handleSort(c.field)}
className='px-2 py-3 text-xs font-medium tracking-wider text-gray-500 uppercase cursor-pointer last:pr-6 text-left'
style={{
minWidth: c.columnWidth != null ? `${c.columnWidth}px` : undefined,
minWidth: getColumnWidthStyle(c.columnWidth),
}}
>
{c.headerName} {orderBy.field === c.field && orderIcon}
Expand Down Expand Up @@ -203,7 +208,7 @@ export const Table: FC<TableProps> = ({
key={`${index}-${c.field}`}
className='px-2 py-2 text-primary-900 last:pr-6'
style={{
minWidth: c.columnWidth != null ? `${c.columnWidth}px` : undefined,
minWidth: getColumnWidthStyle(c.columnWidth),
}}
data-tooltip-content={
typeof row[c.field] === 'string' &&
Expand Down

0 comments on commit cffd1b8

Please sign in to comment.