fix(client): add hover states to tables, cards, stat boxes and icon buttons

Clickable surfaces across the app set `cursor: pointer` but gave no visual
response on hover, so rows and cards read as static text.

Two separate causes:

- `DataTable` never passed MUI's opt-in `hover` prop on `TableRow`, which is
  `false` by default, so no table in the app shaded on hover. One change here
  covers all 16 page tables (Uptime, Incidents, Tags, Team, Notifications,
  Maintenance, Proxies, Status pages, Checks, Geo checks, Infrastructure,
  PageSpeed and the three Logs tables).
- `IconButton` gates its hover style behind `props => !props.disableRipple`,
  and the theme sets `disableRipple: true` globally, so the row action gear
  and the pagination arrows lost their background. `MenuItem` is unaffected —
  its hover sits on the base style — so action menu items already worked and
  are left alone.

Adds a `HOVER.ROW` (0.025) constant and an `action.rowHover` palette token,
defined in both light and dark palettes so the overlay direction is correct on
each surface. Kept separate from MUI's shared `action.hover` so menu items,
which read that token, are not restyled as a side effect.

Also fixes `cursor` on expandable rows, which showed `default` despite being
clickable to expand.

Claude-Session: https://claude.ai/code/session_01AbYLvwpEaZFXktHVcqrFRd
This commit is contained in:
gorkem-bwl committed 2026-08-28 19:13:33 -04:00
1 parent 46211ac61d
commit 9a6602b9e1
6 files changed
+55 -5

No files matched your search

+10 -1
View File
@@ -3,6 +3,7 @@ import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import IconButton from "@mui/material/IconButton";
import { Settings } from "lucide-react";
import { useTheme } from "@mui/material/styles";
export type ActionMenuItem = {
id: number | string;
@@ -12,6 +13,7 @@ export type ActionMenuItem = {
};
export const ActionsMenu = ({ items }: { items: ActionMenuItem[] }) => {
const theme = useTheme();
const [anchorEl, setAnchorEl] = useState<null | any>(null);
const open = Boolean(anchorEl);
@@ -27,7 +29,14 @@ export const ActionsMenu = ({ items }: { items: ActionMenuItem[] }) => {
return (
<div>
<IconButton onClick={handleClick}>
<IconButton
onClick={handleClick}
sx={{
"&:hover": {
backgroundColor: theme.palette.action.rowHover,
},
}}
>
<Settings
size={20}
strokeWidth={1.5}
@@ -64,7 +64,12 @@ export const StatBox = ({
palette={palette}
sx={{
...(sx as object),
...(onClick ? { cursor: "pointer", "&:hover": { opacity: 0.95 } } : {}),
...(onClick
? {
cursor: "pointer",
"&:hover": { backgroundColor: theme.palette.action.rowHover },
}
: {}),
}}
>
<Stack onClick={onClick}>
@@ -108,6 +108,11 @@ export function DataTable<
borderRadius: theme.shape.borderRadius,
padding: theme.spacing(LAYOUT.XS),
cursor: onRowClick ? "pointer" : "default",
...(onRowClick && {
"&:hover": {
backgroundColor: theme.palette.action.rowHover,
},
}),
}}
key={key}
>
@@ -207,6 +212,10 @@ export function DataTable<
"& .MuiTableBody-root .MuiTableRow-root:last-child .MuiTableCell-root": {
borderBottom: "none",
},
"& .MuiTableBody-root .MuiTableRow-root.is-clickable:hover .MuiTableCell-root":
{
backgroundColor: theme.palette.action.rowHover,
},
}}
>
<TableHead>
@@ -231,8 +240,9 @@ export function DataTable<
return (
<Fragment key={key}>
<TableRow
className={onRowClick || expandableRows ? "is-clickable" : undefined}
sx={{
cursor: onRowClick ? "pointer" : "default",
cursor: onRowClick || expandableRows ? "pointer" : "default",
...(getRowSx?.(row) as object),
}}
onClick={() => {
@@ -314,7 +324,13 @@ function TablePaginationActions(props: TablePaginationActionsProps) {
return (
<Box
sx={{ flexShrink: 0, ml: { xs: 0, md: 2.5 } }}
sx={{
flexShrink: 0,
ml: { xs: 0, md: 2.5 },
"& .MuiIconButton-root:not(.Mui-disabled):hover": {
backgroundColor: theme.palette.action.rowHover,
},
}}
className="table-pagination-actions"
>
<IconButton
@@ -412,7 +428,13 @@ function HasMoreTablePaginationActions(props: HasMoreTablePaginationActionsProps
return (
<Box
sx={{ flexShrink: 0, ml: { xs: 0, md: 2.5 } }}
sx={{
flexShrink: 0,
ml: { xs: 0, md: 2.5 },
"& .MuiIconButton-root:not(.Mui-disabled):hover": {
backgroundColor: theme.palette.action.rowHover,
},
}}
className="table-pagination-actions"
>
<IconButton
+7
View File
@@ -1,4 +1,5 @@
import { alpha } from "@mui/material/styles";
import { HOVER } from "@/Utils/Theme/constants";
const typographyBase = 13;
@@ -39,6 +40,9 @@ export const lightPalette = {
primary: {
main: colors.brandGreen,
},
action: {
rowHover: alpha(colors.gray900, HOVER.ROW),
},
secondary: {
main: colors.gray200,
},
@@ -65,6 +69,9 @@ export const darkPalette = {
primary: {
main: colors.brandGreen,
},
action: {
rowHover: alpha("#FFFFFF", HOVER.ROW),
},
secondary: {
main: colors.gray700,
},
+6
View File
@@ -13,6 +13,12 @@ declare module "@mui/material/styles" {
eyebrow?: React.CSSProperties;
fontFamilyMonospace?: string;
}
interface TypeAction {
rowHover: string;
}
interface TypeActionOptions {
rowHover?: string;
}
interface Palette {
sidebar: { accent: string };
rowStatus: { running: string; paused: string };
+1
View File
@@ -20,4 +20,5 @@ export const LAYOUT = {
export const HOVER = {
DARKEN: 0.06, // This is a coefficient for darkening function
ROW: 0.025, // Overlay alpha for hoverable rows, cards and icon buttons
} as const;