Skip to content

Commit

Permalink
Fix Storybook control docgen for gridStyle/rowHeightsOptions/`too…
Browse files Browse the repository at this point in the history
…lbarVisibility` stories

- for some reason the ref was breaking the docgen??

- we didn't actually need the stateful grid for the ref tests, so just get rid of it
  • Loading branch information
cee-chen committed Sep 11, 2024
1 parent 5d47175 commit d7d70c2
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 11 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/eui/src/components/datagrid/data_grid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const CellActions: Story = {
dataGridRef.current?.setFocusedCell({ rowIndex: 2, colIndex: 2 });
}, []);

return <StatefulDataGrid {...defaultStorybookArgs} ref={dataGridRef} />;
return <EuiDataGrid {...defaultStorybookArgs} ref={dataGridRef} />;
},
};

Expand All @@ -160,7 +160,7 @@ export const CellExpansionPopover: Story = {
dataGridRef.current?.openCellPopover({ rowIndex: 1, colIndex: 1 });
}, []);

return <StatefulDataGrid {...defaultStorybookArgs} ref={dataGridRef} />;
return <EuiDataGrid {...defaultStorybookArgs} ref={dataGridRef} />;
},
};

Expand Down
11 changes: 2 additions & 9 deletions packages/eui/src/components/datagrid/data_grid.stories.utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import React, {
useCallback,
useEffect,
useState,
forwardRef,
FunctionComponent,
} from 'react';
import { faker } from '@faker-js/faker';
Expand All @@ -27,7 +26,6 @@ import type {
EuiDataGridColumnCellActionProps,
EuiDataGridColumnSortingConfig,
EuiDataGridProps,
EuiDataGridRefProps,
EuiDataGridStyle,
EuiDataGridRowHeightsOptions,
EuiDataGridToolBarVisibilityOptions,
Expand Down Expand Up @@ -293,10 +291,7 @@ export const defaultStorybookArgs = {
} as const,
};

export const StatefulDataGrid = forwardRef<
EuiDataGridRefProps,
EuiDataGridProps
>((props, ref) => {
export const StatefulDataGrid = (props: EuiDataGridProps) => {
const { pagination, sorting, columnVisibility, ...rest } = props;

// Pagination
Expand Down Expand Up @@ -360,7 +355,6 @@ export const StatefulDataGrid = forwardRef<
return (
<EuiDataGrid
{...rest}
ref={ref}
columnVisibility={{ visibleColumns, setVisibleColumns }}
sorting={{ columns: sortingColumns, onSort }}
pagination={{
Expand All @@ -370,8 +364,7 @@ export const StatefulDataGrid = forwardRef<
}}
/>
);
});
StatefulDataGrid.displayName = 'StatefulDataGrid';
};

/*
* Components that exist purely for allowing Storybook to parse certain nested
Expand Down

0 comments on commit d7d70c2

Please sign in to comment.