Skip to content

Commit

Permalink
feat: updated typescript for optional table instance (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fran McDade authored and Fran McDade committed Jul 5, 2024
1 parent 4354fb2 commit f825552
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Drawer, DrawerTitle } from "./rowDrawer.styles";
export interface RowDrawerProps<T extends RowData>
extends Omit<MDrawerProps, "content" | "title"> {
className?: string;
tableInstance: Table<T>;
tableInstance?: Table<T>;
title: ReactNode;
}

Expand All @@ -24,13 +24,14 @@ export const RowDrawer = <T extends RowData>({
title,
...props /* Spread props to allow for Mui Drawer specific prop overrides. */
}: RowDrawerProps<T>): JSX.Element => {
const { getIsRowPreview, resetRowPreview, toggleRowPreview } = tableInstance;
const { getIsRowPreview, resetRowPreview, toggleRowPreview } =
tableInstance || {};
return (
<Drawer
{...DEFAULT_DRAWER_PROPS}
className={className}
onTransitionExited={resetRowPreview}
open={getIsRowPreview()}
open={getIsRowPreview?.()}
{...props}
>
<DrawerTitle
Expand Down

0 comments on commit f825552

Please sign in to comment.