Skip to content

Commit 09fc2da

Browse files
committed
chore: improve docs per review comments
1 parent 14bf7b3 commit 09fc2da

File tree

4 files changed

+21
-44
lines changed

4 files changed

+21
-44
lines changed

cypress/e2e/DataView.spec.cy.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
describe('Test the Data view docs page', () => {
2-
2+
33
it('displays a layout with a table and paginates', () => {
44
const ouiaId = 'LayoutExample';
5+
cy.viewport(1400, 2800)
56

67
cy.visit('http://localhost:8006/extensions/data-view/data-view');
78

8-
cy.get(`[data-ouia-component-id="${ouiaId}-th-0"]`).scrollIntoView().contains('Repositories');
9+
cy.get(`[data-ouia-component-id="${ouiaId}-th-0"]`).scrollIntoView().contains('Repository');
910
cy.get(`[data-ouia-component-id="${ouiaId}Header-pagination"]`).should('exist');
1011
cy.get(`[data-ouia-component-id="${ouiaId}Header-bulk-select"]`).should('exist');
1112

1213
cy.get(`[data-ouia-component-id="${ouiaId}Footer-pagination"]`).should('exist');
1314
cy.get(`[data-ouia-component-id="${ouiaId}Footer-bulk-select"]`).should('not.exist');
1415

15-
cy.get(`[data-ouia-component-id="${ouiaId}-th-0"]`).contains('Repositories');
16+
cy.get(`[data-ouia-component-id="${ouiaId}-th-0"]`).contains('Repository');
1617
cy.get(`[data-ouia-component-id="${ouiaId}-th-4"]`).contains('Last commit');
1718

1819
cy.get(`[data-ouia-component-id="${ouiaId}-td-0-0"]`).contains('Repository one');
@@ -41,27 +42,12 @@ describe('Test the Data view docs page', () => {
4142
});
4243
cy.contains('5 selected').should('exist');
4344

44-
// select none
45-
cy.get(`[data-ouia-component-id="BulkSelect-toggle"`).first().click({ force: true });
46-
cy.get(`[data-ouia-component-id="BulkSelect-select-none"`).first().click();
47-
cy.contains('5 selected').should('not.exist');
48-
49-
// select all
50-
cy.get(`[data-ouia-component-id="BulkSelect-toggle"`).first().click({ force: true });
51-
cy.get(`[data-ouia-component-id="BulkSelect-select-all"`).first().click();
52-
cy.get('[data-ouia-component-id="LayoutExample"] input[type="checkbox"]')
53-
.each(($checkbox) => {
54-
cy.wrap($checkbox).should('be.checked');
55-
});
56-
cy.contains('6 selected').should('exist');
57-
5845
// page checkbox deselect
5946
cy.get(`[data-ouia-component-id="BulkSelect-checkbox"`).first().click();
6047
cy.get('[data-ouia-component-id="LayoutExample"] input[type="checkbox"]')
6148
.each(($checkbox) => {
6249
cy.wrap($checkbox).should('not.be.checked');
6350
});
64-
cy.contains('1 selected').should('exist');
6551

6652
// select page
6753
cy.get(`[data-ouia-component-id="BulkSelect-toggle"`).first().click({ force: true });
@@ -70,6 +56,6 @@ describe('Test the Data view docs page', () => {
7056
.each(($checkbox) => {
7157
cy.wrap($checkbox).should('be.checked');
7258
});
73-
cy.contains('6 selected').should('exist');
59+
cy.contains('5 selected').should('exist');
7460
})
7561
});

packages/module/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
section: extensions
33
subsection: Data view
4-
id: Data view
4+
id: Overview
5+
title: Data view overview
56
propComponents: ['DataView']
67
sortValue: 1
78
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md
@@ -19,53 +20,45 @@ import { DataViewFilters } from '@patternfly/react-data-view/dist/dynamic/DataVi
1920
import { DataViewTextFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewTextFilter';
2021
import { DataViewCheckboxFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewCheckboxFilter';
2122

22-
## Core concepts
23-
24-
The **data view** extension helps you display datasets in organized layouts containing data representation and toolbars allowing interactions like selection or pagination.
25-
26-
Sub-components for displaying the data (card view, table) and toolbars (top and bottom) are always passed as `children` to the `DataView` component.
27-
28-
---
29-
3023
**Note:** Data view lives in its own package [`@patternfly/react-data-view`](https://www.npmjs.com/package/@patternfly/react-data-view)
3124

32-
If you notice a bug, or if you have a suggestion for improving the data view extension or its documentation, please file an issue in [the react-data-view repository](https://github.com/patternfly/react-data-view/issues). Before doing so, please make sure there is not already a pre-existing issue.
25+
If you notice a bug, or if you have a suggestion for improving the data view extension or its documentation, please file an issue in the [react-data-view](https://github.com/patternfly/react-data-view/issues) repository. Before doing so, please make sure there is not already a pre-existing issue.
3326

3427
---
3528

29+
The **data view** extension helps you display datasets in organized layouts containing data representation and toolbars allowing interactions like selection or pagination.
30+
3631
### Layout
3732

38-
Data view is expected to consist of header, data representation part and footer stacked below each other. The layout is implemented using PatternFly [stack](/layouts/stack).
33+
A data view should contain a header, the data representation (like a card view or table), and a footer. These parts are organized in a [stack layout](/layouts/stack).
34+
35+
The data view toolbars and sub-components that display the data (like a card view or table) are always passed as `children` to the `<DataView>` component.
3936

4037
```js file="./AbstractLayoutExample.tsx"
4138

4239
```
4340

4441
### Modularity
4542

46-
The extension's modular architecture lets you efficiently create consistent data views by using predefined sub-components and hooks or defining your own. You can choose the tools that suit your needs and easily replace any part with a custom implementation.
43+
The extension's modular architecture lets you efficiently create consistent data views, by either using predefined sub-components and hooks, or by defining your own. You can choose the tools that suit your needs and easily replace any part with a custom implementation.
4744

48-
For the toolbar, you can make use of the predefined `DataViewToolbar` component, which extends the PatternFly [toolbar](/components/toolbar) with the most common use cases. For more details, please refer to the [Toolbar](/extensions/data-view/toolbar) section. In case it does not fit your needs, you can also use your custom toolbar component.
45+
The `<DataViewToolbar>` component extends the [PatternFly toolbar](/components/toolbar) to support the most common needs. For more details, refer to the [data view toolbar](/extensions/data-view/toolbar) examples. You can also use a custom toolbar component if needed for your use case.
4946

50-
Data can be presented using the predefined `DataViewTable` component, which is an abstraction above the PatternFly [table](/components/table). For more details, please refer to the [Table](/extensions/data-view/table) docs section. In the near future, we are also planning to introduce a predefined Card view component. If you have more specific needs to display data, you can pass your custom implementation as a `DataView` child.
47+
Data can be presented using the predefined `<DataViewTable>` component, which is an abstraction above the [PatternFly table](/components/table). For more details, refer to the [data view table](/extensions/data-view/table) examples. If you have more specific data display needs, you can pass a custom implementation as a `<DataView>` child. In the near future, we are also planning to introduce a predefined card view component.
5148

5249
```js file="./PredefinedLayoutFullExample.tsx"
5350

5451
```
5552

5653
## Advanced concepts
5754

58-
This section contains advanced features related to the `DataView` wrapping component and information to better understand how the data view works under the hood.
59-
60-
### Data view context
61-
62-
The **data view internal context** provides shared state to all sub-components. It lives inside the `DataView` component to store callbacks for the data selection (`onSelect`, `isSelected`, `isSelectDisabled`), internally computed `isSelectable` flag based on selection callbacks passed, and `activeState` of the data view (loading, error, etc.). Its values are set up through props of the `DataView` component.
55+
This section contains advanced features related to the `<DataView>` wrapping component and information to better understand how the data view works under the hood.
6356

6457
### Events context
6558

66-
The **data view events context** provides a way of listening to the data view events from the outside of the component through the `DataViewEventsContext`.
59+
The `<DataViewEventsContext>` provides a method of listening to the data view events from the outside of the component.
6760

68-
In order to give your components an access to the shared context, wrap them and your data view with the `DataViewEventsProvider`.
61+
In order to give your other UI components access to the shared context, wrap them and your data view with the `<DataViewEventsProvider>`.
6962

7063
### Row click subscription example
7164
This example illustrates how to set up a layout that listens for row click events and displays detailed information about the selected row in a [drawer component](/components/drawer).

packages/module/patternfly-docs/content/extensions/data-view/examples/Table/Table.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ subsection: Data view
66
# Sidenav secondary level section
77
# should be the same for all markdown files
88
id: Table
9+
title: Data view table
910
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
1011
source: react
1112
# If you use typescript, the name of the interface to display props for
@@ -24,8 +25,6 @@ import { DataViewTable } from '@patternfly/react-data-view/dist/dynamic/DataView
2425
import { useDataViewSelection, useDataViewSort } from '@patternfly/react-data-view/dist/dynamic/Hooks';
2526
import { DataView, DataViewState } from '@patternfly/react-data-view/dist/dynamic/DataView';
2627

27-
## Data view table
28-
2928
The **data view table** component is an abstraction that renders your columns and rows in the PatternFly [table](/components/table) component.
3029

3130
Below, you can see an example of displaying `rows` and `columns` in the `DataViewTable`, which simplifies the table declaration, but at the same time keeps the customization possibilities of the core component.

packages/module/patternfly-docs/content/extensions/data-view/examples/Toolbar/Toolbar.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ subsection: Data view
66
# Sidenav secondary level section
77
# should be the same for all markdown files
88
id: Toolbar
9+
title: Data view toolbar
910
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
1011
source: react
1112
# If you use typescript, the name of the interface to display props for
@@ -25,8 +26,6 @@ import { DataViewFilters } from '@patternfly/react-data-view/dist/dynamic/DataVi
2526
import { DataViewTextFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewTextFilter';
2627
import { DataViewCheckboxFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewCheckboxFilter';
2728

28-
## Data view toolbar
29-
3029
The **data view toolbar** component renders a default opinionated data view toolbar above or below the data section.
3130

3231
Data view toolbar can contain pagination, bulk select, filters, actions or other child content passed. The preffered way of passing child toolbar items is using the [toolbar item](/components/toolbar#toolbar-items) component or predefined `DataViewToolbar` props for specific use cases.

0 commit comments

Comments
 (0)