MCPcopy Index your code
hub / github.com/coder/coder / useClickableTableRow

Function useClickableTableRow

site/src/hooks/useClickableTableRow.ts:45–75  ·  view source on GitHub ↗
({
	role,
	onClick,
	onDoubleClick,
	onMiddleClick,
	onAuxClick: externalOnAuxClick,
}: UseClickableTableRowConfig<TRole>)

Source from the content-addressed store, hash-verified

43 };
44
45export const useClickableTableRow = <
46 TRole extends ClickableAriaRole = ClickableAriaRole,
47>({
48 role,
49 onClick,
50 onDoubleClick,
51 onMiddleClick,
52 onAuxClick: externalOnAuxClick,
53}: UseClickableTableRowConfig<TRole>): UseClickableTableRowResult<TRole> => {
54 const clickableProps = useClickable(onClick, (role ?? "button") as TRole);
55
56 return {
57 ...clickableProps,
58 className: cn([
59 "cursor-pointer hover:outline focus-visible:outline outline-1 -outline-offset-1 outline-border-secondary",
60 "first:rounded-t-md last:rounded-b-md",
61 ]),
62 hover: true,
63 onDoubleClick,
64 onAuxClick: (event) => {
65 // Regardless of which callback gets called, the hook won't stop the event
66 // from bubbling further up the DOM
67 const isMiddleMouseButton = event.button === 1;
68 if (isMiddleMouseButton) {
69 onMiddleClick?.(event);
70 } else {
71 externalOnAuxClick?.(event);
72 }
73 },
74 };
75};

Callers 8

GroupRowFunction · 0.90
ProviderRowFunction · 0.90
TaskRowFunction · 0.90
WorkspacesRowFunction · 0.90
OAuth2AppRowFunction · 0.90
UserRowFunction · 0.90
TemplateRowFunction · 0.90
VersionRowFunction · 0.90

Calls 2

useClickableFunction · 0.90
cnFunction · 0.90

Tested by

no test coverage detected