import React from 'react' import EmptyState from '../EmptyState/EmptyState' import { useMediaQuery } from '../../hooks/responsiveHooks' import DesktopTable from './Desktop/DesktopTable' import MobileTable from './Mobile/MobileTable' import type { ConfigItemType, StandardTableProps } from './StandardTable.models' import styles from './_table.module.scss' import TableHeader from './TableHeader/TableHeader' import { getTotalOptionsDefaultValue } from './helperCheckboxFunctions' const StandardTable = < DataItem, ConfigItem extends ConfigItemType>, FilterOption, >( props: StandardTableProps, ): React.JSX.Element => { const { hasData, loading, tableId, noDataFields, largeMobileBreakpoint, noMobileView, tableHeaderProps, qaTestId = 'standard-table', } = props const localStorageName = `sort_by_${tableId}` const isMobileView = useMediaQuery({ type: 'max', breakpoint: largeMobileBreakpoint ? 'lg' : 'md', }) return (
{tableHeaderProps ? (
) : null} {!isMobileView || noMobileView ? ( // @ts-expect-error Having an issue with the totalRowKey generic. For now, we will expect this error until we figure out how to deal with this error. ) : ( // @ts-expect-error Having an issue with the DataItem generic. For now, we will expect this error until we figure out how to deal with this error. )} {!loading && !hasData ? : null}
) } export default StandardTable // COMMON TABLE PROPS export const color = { red: styles.redFont, gray: styles.darkPurpleFont, yellow: styles.darkYellowFont, green: styles.darkGreenFont, blue: styles.chartStandardBlueFont, } export const backgroundColor = { red: styles.lightRedBackground, gray: styles.lighterGrayBackground, yellow: styles.lightYellowBackground, green: styles.lightGreenBackground, blue: styles.mediumBlueBackground, }