Skip to content

Commit

Permalink
REVERT ME: testing example
Browse files Browse the repository at this point in the history
  • Loading branch information
mgadewoll committed Nov 13, 2024
1 parent 228d157 commit a690bf9
Showing 1 changed file with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import {
EuiAvatar,
EuiToolTip,
EuiButtonIcon,
EuiModal,
EuiModalBody,
EuiButton,
} from '../../../../../src/components';

const CustomHeaderCell = ({ title }) => (
Expand Down Expand Up @@ -67,21 +70,33 @@ for (let i = 1; i < 5; i++) {
}

export default () => {
const [isOpen, setOpen] = useState(false);
const [visibleColumns, setVisibleColumns] = useState(
columns.map(({ id }) => id)
);

return (
<EuiDataGrid
aria-label="DataGrid demonstrating column reordering on drag"
columns={columns}
columnVisibility={{
visibleColumns: visibleColumns,
setVisibleColumns: setVisibleColumns,
canDragAndDropColumns: true,
}}
rowCount={data.length}
renderCellValue={({ rowIndex, columnId }) => data[rowIndex][columnId]}
/>
<>
<EuiButton onClick={() => setOpen(!isOpen)}>Toggle modal</EuiButton>
{isOpen && (
<EuiModal onClose={() => setOpen(false)}>
<EuiModalBody>
<EuiDataGrid
aria-label="DataGrid demonstrating column reordering on drag"
columns={columns}
columnVisibility={{
visibleColumns: visibleColumns,
setVisibleColumns: setVisibleColumns,
canDragAndDropColumns: true,
}}
rowCount={data.length}
renderCellValue={({ rowIndex, columnId }) =>
data[rowIndex][columnId]
}
/>
</EuiModalBody>
</EuiModal>
)}
</>
);
};

0 comments on commit a690bf9

Please sign in to comment.