Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiDataGrid] Various row height fixes #8025

Merged
merged 11 commits into from
Sep 19, 2024
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.
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 43 additions & 11 deletions packages/eui/src/components/datagrid/data_grid.stories.utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ import React, {
useState,
FunctionComponent,
} from 'react';
import { css } from '@emotion/react';
import { faker } from '@faker-js/faker';

import { EuiLink } from '../link';
import { EuiScreenReaderOnly } from '../accessibility';
import { EuiButtonIcon } from '../button';
import { EuiCheckbox } from '../form';
import { EuiBadge } from '../badge';

import { MINIMUM_WIDTH_FOR_GRID_CONTROLS } from './controls/data_grid_toolbar';
import type {
Expand Down Expand Up @@ -73,7 +76,7 @@ export const raw_data = Array.from({ length: 10 }).map((_, i) => {
raw: name,
},
email: {
formatted: <EuiLink href="">{faker.internet.email()}</EuiLink>,
formatted: <EuiLink href="">{email}</EuiLink>,
raw: email,
},
location: (
Expand All @@ -82,9 +85,18 @@ export const raw_data = Array.from({ length: 10 }).map((_, i) => {
<EuiLink href="https://google.com">{faker.location.country()}</EuiLink>
</>
),
date: `${date}`,
date,
account: faker.finance.accountNumber(),
version: faker.system.semver(),
version: (
<EuiBadge
// Tweak the badge's vertical centering
css={css`
vertical-align: text-bottom;
`}
>
{faker.system.semver()}
</EuiBadge>
),
};
});

Expand Down Expand Up @@ -185,6 +197,7 @@ const columns = [
initialWidth: 70,
isResizable: false,
actions: false as const,
schema: 'version', // Custom schema + CSS
},
];

Expand Down Expand Up @@ -212,31 +225,50 @@ const RenderCellValue = ({

export const defaultStorybookArgs = {
'aria-label': 'EuiDataGrid',
css: css`
.euiDataGridRowCell--version,
.euiDataGridHeaderCell--version .euiDataGridHeaderCell__content {
mgadewoll marked this conversation as resolved.
Show resolved Hide resolved
text-align: center;
}
`,
columns,
rowCount: 10,
renderCellValue: RenderCellValue,
trailingControlColumns: [
{
id: 'trailing-actions',
width: 40,
width: 64,
headerCellRender: () => (
<EuiScreenReaderOnly>
<span>Trailing actions</span>
<span>Row actions</span>
</EuiScreenReaderOnly>
),
rowCellRender: () => <EuiButtonIcon iconType="boxesHorizontal" />,
rowCellRender: () => (
<>
<EuiButtonIcon iconType="indexEdit" />
<EuiButtonIcon iconType="boxesHorizontal" />
</>
),
},
],
leadingControlColumns: [
{
id: 'leading-actions',
width: 40,
width: 32,
headerCellRender: () => (
<EuiScreenReaderOnly>
<span>Leading actions</span>
</EuiScreenReaderOnly>
<EuiCheckbox
id="selectAll"
aria-label="Select all rows"
onChange={() => {}}
/>
),
rowCellRender: ({ rowIndex }: EuiDataGridCellValueElementProps) => (
<EuiCheckbox
id={`selectRow${rowIndex}`}
aria-label={`Select row ${rowIndex + 1}`}
onChange={() => {}}
/>
),
rowCellRender: () => <EuiButtonIcon iconType="boxesHorizontal" />,
},
],
// setup for easier testing/QA
Expand Down