-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[storybook] Move row height stories to their own file/subdir
- allows us to expand props documentation & use controls for `rowHeightsOptions` + add test for lineHeight
- Loading branch information
Showing
19 changed files
with
106 additions
and
73 deletions.
There are no files selected for viewing
Binary file removed
BIN
-44.4 KB
...oki/reference/chrome_desktop_Tabular_Content_EuiDataGrid_Custom_Row_Heights.png
Binary file not shown.
Binary file removed
BIN
-39.6 KB
...loki/reference/chrome_desktop_Tabular_Content_EuiDataGrid_Height_Line_Count.png
Binary file not shown.
Binary file removed
BIN
-46.4 KB
...s/eui/.loki/reference/chrome_desktop_Tabular_Content_EuiDataGrid_Row_Height.png
Binary file not shown.
Binary file added
BIN
+8.21 KB
....loki/reference/chrome_desktop_Tabular_Content_EuiDataGrid_Row_Heights_Auto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+51.9 KB
...e/chrome_desktop_Tabular_Content_EuiDataGrid_Row_Heights_Custom_Line_Height.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+58.4 KB
...e/chrome_desktop_Tabular_Content_EuiDataGrid_Row_Heights_Custom_Row_Heights.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+65.5 KB
...reference/chrome_desktop_Tabular_Content_EuiDataGrid_Row_Heights_Line_Count.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+62.1 KB
...erence/chrome_desktop_Tabular_Content_EuiDataGrid_Row_Heights_Static_Height.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-67.5 KB
...loki/reference/chrome_mobile_Tabular_Content_EuiDataGrid_Custom_Row_Heights.png
Binary file not shown.
Binary file removed
BIN
-61.2 KB
....loki/reference/chrome_mobile_Tabular_Content_EuiDataGrid_Height_Line_Count.png
Binary file not shown.
Binary file removed
BIN
-75.7 KB
...es/eui/.loki/reference/chrome_mobile_Tabular_Content_EuiDataGrid_Row_Height.png
Binary file not shown.
Binary file added
BIN
+11.1 KB
.../.loki/reference/chrome_mobile_Tabular_Content_EuiDataGrid_Row_Heights_Auto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+61.4 KB
...ce/chrome_mobile_Tabular_Content_EuiDataGrid_Row_Heights_Custom_Line_Height.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+70.5 KB
...ce/chrome_mobile_Tabular_Content_EuiDataGrid_Row_Heights_Custom_Row_Heights.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+78.2 KB
.../reference/chrome_mobile_Tabular_Content_EuiDataGrid_Row_Heights_Line_Count.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+74.6 KB
...ference/chrome_mobile_Tabular_Content_EuiDataGrid_Row_Heights_Static_Height.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
packages/eui/src/components/datagrid/data_grid_row_heights.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { enableFunctionToggleControls } from '../../../.storybook/utils'; | ||
|
||
import { | ||
StatefulDataGrid, | ||
defaultStorybookArgs, | ||
EuiDataGridRowHeightsPropsComponent, | ||
} from './data_grid.stories.utils'; | ||
import type { EuiDataGridRowHeightsOptions } from './data_grid_types'; | ||
|
||
const meta: Meta<EuiDataGridRowHeightsOptions> = { | ||
title: 'Tabular Content/EuiDataGrid/Row Heights', | ||
component: EuiDataGridRowHeightsPropsComponent, | ||
parameters: { | ||
codeSnippet: { | ||
snippet: `<EuiDataGrid rowHeightOptions={{{STORY_ARGS}}} />`, | ||
}, | ||
}, | ||
}; | ||
enableFunctionToggleControls(meta, ['onChange']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiDataGridRowHeightsOptions>; | ||
|
||
const storyArgs = { | ||
...defaultStorybookArgs, | ||
width: 800, // make it easier to test wrapping text | ||
rowCount: 5, // make VRT screenshots smaller | ||
}; | ||
|
||
export const Auto: Story = { | ||
args: { | ||
defaultHeight: 'auto', | ||
}, | ||
render: (rowHeightsOptions) => ( | ||
<StatefulDataGrid {...storyArgs} rowHeightsOptions={rowHeightsOptions} /> | ||
), | ||
}; | ||
|
||
export const LineCount: Story = { | ||
args: { | ||
defaultHeight: { lineCount: 2 }, | ||
}, | ||
render: (rowHeightsOptions) => ( | ||
<StatefulDataGrid | ||
{...storyArgs} | ||
rowHeightsOptions={rowHeightsOptions} | ||
// Visual regression test for https://github.com/elastic/eui/issues/7780 | ||
// Last two rows of the 'Location' column should *not* have any | ||
// barely visible text below the ... line-clamp truncation | ||
gridStyle={{ fontSize: 'm', cellPadding: 'l' }} | ||
/> | ||
), | ||
}; | ||
|
||
export const StaticHeight: Story = { | ||
args: { | ||
defaultHeight: { height: 48 }, | ||
}, | ||
render: (rowHeightsOptions) => ( | ||
<StatefulDataGrid {...storyArgs} rowHeightsOptions={rowHeightsOptions} /> | ||
), | ||
}; | ||
|
||
export const CustomRowHeights: Story = { | ||
parameters: { controls: { include: ['rowHeights'] } }, | ||
args: { | ||
rowHeights: { | ||
2: 'auto', | ||
3: 48, | ||
4: { | ||
height: 56, | ||
}, | ||
5: { | ||
lineCount: 2, | ||
}, | ||
}, | ||
}, | ||
render: (rowHeightsOptions) => ( | ||
<StatefulDataGrid {...storyArgs} rowHeightsOptions={rowHeightsOptions} /> | ||
), | ||
}; | ||
|
||
export const CustomLineHeight: Story = { | ||
parameters: { controls: { include: ['lineHeight'] } }, | ||
args: { | ||
lineHeight: '40px', | ||
}, | ||
render: (rowHeightsOptions) => ( | ||
<StatefulDataGrid {...storyArgs} rowHeightsOptions={rowHeightsOptions} /> | ||
), | ||
}; |