diff --git a/packages/react-component-library/src/components/DataGrid/DataGrid.stories.tsx b/packages/react-component-library/src/components/DataGrid/DataGrid.stories.tsx index 3bc7724d5b..3edfa88d6a 100644 --- a/packages/react-component-library/src/components/DataGrid/DataGrid.stories.tsx +++ b/packages/react-component-library/src/components/DataGrid/DataGrid.stories.tsx @@ -1,4 +1,6 @@ import React from 'react' +import styled from 'styled-components' +import { selectors } from '@royalnavy/design-tokens' import { fn } from '@storybook/test' import { faker } from '@faker-js/faker' import { StoryFn, Meta } from '@storybook/react' @@ -11,6 +13,7 @@ type Order = { id: number productName: string quantity: number + price: string } const generateRandomData = (length: number): Order[] => { @@ -19,6 +22,7 @@ const generateRandomData = (length: number): Order[] => { id: i + 1, productName: faker.commerce.productName(), quantity: faker.number.int({ min: 1, max: 100 }), + price: `£${faker.commerce.price()}`, } }) @@ -38,8 +42,19 @@ const columns = [ accessorKey: 'quantity', enableSorting: false, }, + { + header: 'Price', + accessorKey: 'price', + enableSorting: false, + }, ] +const { spacing } = selectors + +const Wrapper = styled.div` + padding: ${spacing('4')}; +` + export default { component: DataGrid, subcomponents: {}, @@ -57,7 +72,11 @@ export default { } as Meta export const Default: StoryFn = (props) => { - return + return ( + + + + ) } Default.args = { @@ -73,7 +92,11 @@ const columnsWithSorting = columns.map((item) => ({ })) export const Sorting: StoryFn = (props) => { - return + return ( + + + + ) } Sorting.args = { @@ -104,7 +127,11 @@ const columnsWithArbitraryContent: ColumnDef[] = columns.map( ) export const ArbitraryCellContent: StoryFn = (props) => { - return + return ( + + + + ) } ArbitraryCellContent.storyName = 'Arbitrary cell content' @@ -125,7 +152,11 @@ ArbitraryCellContent.parameters = { } export const RowSelection: StoryFn = (props) => { - return + return ( + + + + ) } RowSelection.storyName = 'Row selection' @@ -152,7 +183,11 @@ RowSelection.parameters = { } export const RowSelectionWithHover: StoryFn = (props) => { - return + return ( + + + + ) } RowSelectionWithHover.storyName = 'Row selection with hover' @@ -170,7 +205,11 @@ RowSelectionWithHover.args = { } export const Caption: StoryFn = (props) => { - return + return ( + + + + ) } Caption.args = { @@ -186,7 +225,11 @@ const columnsWithSizing = columns.map((item) => ({ })) export const ColumnSizing: StoryFn = (props) => { - return + return ( + + + + ) } ColumnSizing.storyName = 'Column sizing' @@ -202,7 +245,11 @@ const columnsWithAlignment = columns.map((item) => ({ })) export const ColumnAlignment: StoryFn = (props) => { - return + return ( + + + + ) } ColumnAlignment.storyName = 'Column alignment' @@ -215,19 +262,21 @@ ColumnAlignment.args = { const mergedColumns = columns.map((item, index) => ({ ...item, - ...columnsWithSorting[index], ...columnsWithArbitraryContent[index], + enableSorting: true, })) export const KitchenSink: StoryFn = (props) => { return ( - + + + ) }