From 0a855f146d968b06c5eaabe1e1cba73c15e16989 Mon Sep 17 00:00:00 2001 From: Jonathan Fisher Date: Mon, 20 Nov 2023 21:38:39 -0500 Subject: [PATCH] Add pointer cursor when onRowClick is set --- package.json | 2 +- src/components/DataTable/datatable.tsx | 2 ++ stories/DataTable.stories.tsx | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f6495c4..2463c5d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@weng-lab/psychscreen-ui-components", "description": "Typescript and Material UI based components used for psychSCREEN", "author": "SCREEN Team @ UMass Chan Medical School", - "version": "0.8.0-a.2", + "version": "0.8.0-a.3", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/components/DataTable/datatable.tsx b/src/components/DataTable/datatable.tsx index 972a4c8..3a1b897 100644 --- a/src/components/DataTable/datatable.tsx +++ b/src/components/DataTable/datatable.tsx @@ -331,6 +331,7 @@ const DataTable: React.FC> = (props: DataTableProps) => hover key={"row" + i} onClick={() => props.onRowClick && props.onRowClick(row, i + page * rowsPerPage)} + sx={{cursor: props.onRowClick ? "pointer" : "auto"}} onMouseEnter={() => props.onRowMouseEnter && props.onRowMouseEnter(row, i + page * rowsPerPage)} onMouseLeave={() => props.onRowMouseLeave && props.onRowMouseLeave()} > @@ -382,6 +383,7 @@ const DataTable: React.FC> = (props: DataTableProps) => Add Columns {(props.defaultColumnsToShow ? props.columns.filter((c) => !props.defaultColumnsToShow?.includes(c.header)) + //Why is this "or 5" here? Kinda makes no sense? : props.columns.slice(props.noOfDefaultColumns || 5, props.columns.length) ).map((col, i) => ( diff --git a/stories/DataTable.stories.tsx b/stories/DataTable.stories.tsx index c0b2149..fc3dd6f 100644 --- a/stories/DataTable.stories.tsx +++ b/stories/DataTable.stories.tsx @@ -124,7 +124,7 @@ AddMoreColumnsOnSelect.args = { tableTitle: "Table Title", searchable: true, showMoreColumns: true, - noOfDefaultColumns: 3 + noOfDefaultColumns: 2 } HoverInfo.args = {