feat(claims): provider cell drillable to /providers?provider=NPI
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import type { ReactNode } from "react";
|
||||
import type { MouseEvent, ReactNode } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface Props {
|
||||
children: ReactNode;
|
||||
onClick: () => void;
|
||||
/**
|
||||
* Click handler. Receives the underlying React mouse event so we can
|
||||
* call `e.stopPropagation()` before invoking the caller's logic — see
|
||||
* the JSDoc on the component for why this matters when a DrillableCell
|
||||
* is nested inside a row-level click handler.
|
||||
*/
|
||||
onClick: (e: MouseEvent<HTMLButtonElement>) => void;
|
||||
disabled?: boolean;
|
||||
/** Optional aria-label; defaults to the visible text content. */
|
||||
ariaLabel?: string;
|
||||
@@ -18,12 +24,21 @@ interface Props {
|
||||
* Renders as a <button> (disabled when `disabled`) so it gets keyboard
|
||||
* activation (Enter/Space) and the standard disabled-button semantics.
|
||||
* The `drillable` affordance class is omitted when disabled.
|
||||
*
|
||||
* Calls `e.stopPropagation()` on the button click before invoking the
|
||||
* caller's handler. This prevents the click from bubbling to a
|
||||
* row-level `onClick` (e.g. Claims' `<TableRow onClick={() => open(c.id)}>`),
|
||||
* which would otherwise re-fire `buildUrl()` on the now-navigated URL
|
||||
* and corrupt history. Precedent: `src/components/inbox/Lane.tsx:41`.
|
||||
*/
|
||||
export function DrillableCell({ children, onClick, disabled, ariaLabel }: Props) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onClick(e);
|
||||
}}
|
||||
disabled={disabled}
|
||||
aria-label={ariaLabel}
|
||||
className={cn(
|
||||
|
||||
Reference in New Issue
Block a user