Skip to content

Commit 8972b18

Browse files
committed
feat(actions): Add actions docs
1 parent 774af30 commit 8972b18

File tree

4 files changed

+45
-8
lines changed

4 files changed

+45
-8
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/mod
1616
---
1717
import { Button, EmptyState, EmptyStateActions, EmptyStateBody, EmptyStateFooter, EmptyStateHeader, EmptyStateIcon } from '@patternfly/react-core';
1818
import { CubesIcon, FolderIcon, FolderOpenIcon, LeafIcon, ExclamationCircleIcon } from '@patternfly/react-icons';
19-
import { BulkSelect, ErrorState } from '@patternfly/react-component-groups';
19+
import { BulkSelect, ErrorState, ResponsiveAction, ResponsiveActions } from '@patternfly/react-component-groups';
2020
import { DataViewToolbar } from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
2121
import { DataViewTable } from '@patternfly/react-data-view/dist/dynamic/DataViewTable';
2222
import { useDataViewSelection } from '@patternfly/react-data-view/dist/dynamic/Hooks';
@@ -26,14 +26,25 @@ import { DataView, DataViewState } from '@patternfly/react-data-view/dist/dynami
2626

2727
The **data view toolbar** component renders a default opinionated data view toolbar above or below the data section.
2828

29-
Data view toolbar can contain a `pagination`, `bulkSelect` or any other children content passed. The preffered way of passing children toolbar items is using the [toolbar item](/components/toolbar#toolbar-items) component.
29+
Data view toolbar can contain a `pagination`, `bulkSelect`, `actions` or other children content passed. The preffered way of passing children toolbar items is using the [toolbar item](/components/toolbar#toolbar-items) component.
3030

3131
### Basic toolbar example
3232

3333
```js file="./DataViewToolbarExample.tsx"
3434

3535
```
3636

37+
# Toolbar actions
38+
Data view toolbar can display actions using the `actions` property accepting a React node. You can make use of a predefined [responsive actions](/extensions/component-groups/responsive-actions) component from the [component groups](/extensions/component-groups/about-component-groups) extension.
39+
40+
### Actions configuration
41+
42+
### Actions example
43+
44+
```js file="./DataViewToolbarActionsExample.tsx"
45+
46+
```
47+
3748
## Data view table
3849

3950
The **data view table** component renders your columns and rows definition into a [table](/components/table) component.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import { Pagination } from '@patternfly/react-core';
3+
import { BulkSelect, ResponsiveAction, ResponsiveActions } from '@patternfly/react-component-groups';
4+
import { DataViewToolbar } from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
5+
6+
export const BasicExample: React.FunctionComponent = () => (
7+
<DataViewToolbar
8+
bulkSelect={
9+
<BulkSelect
10+
selectedCount={0}
11+
pageCount={5}
12+
onSelect={() => null}
13+
/>
14+
}
15+
actions={
16+
<ResponsiveActions breakpoint="lg" ouiaId="example-actions">
17+
<ResponsiveAction isPersistent variant="primary">Persistent</ResponsiveAction>
18+
<ResponsiveAction isPinned variant="secondary">Pinned</ResponsiveAction>
19+
<ResponsiveAction>Action three</ResponsiveAction>
20+
<ResponsiveAction>Action four</ResponsiveAction>
21+
</ResponsiveActions>
22+
}
23+
pagination={
24+
<Pagination page={1} perPage={10} />
25+
}
26+
/>
27+
)

packages/module/patternfly-docs/content/extensions/data-view/examples/Components/DataViewToolbarExample.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewTo
66

77
export const BasicExample: React.FunctionComponent = () => (
88
<DataViewToolbar
9-
pagination={
10-
<Pagination page={1} perPage={10} />
11-
}
129
bulkSelect={
1310
<BulkSelect
1411
selectedCount={0}
1512
pageCount={5}
1613
onSelect={() => null}
1714
/>
18-
}
15+
}
16+
pagination={
17+
<Pagination page={1} perPage={10} />
18+
}
1919
/>
2020
)

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ This example uses the URL for persisting the pagination state.
6262
Allows to select data records inside the data view and show the selection state.
6363

6464
### Toolbar usage
65-
Data view toolbar can display a bulk selection component using the `bulkSelect` property accepting a React node. You can make use of a predefined [bulk select](/extensions/component-groups/bulk-select) from the [component groups](/extensions/component-groups/about-component-groups) extension.
65+
Data view toolbar can display a bulk selection component using the `bulkSelect` property accepting a React node. You can make use of a predefined [bulk select](/extensions/component-groups/bulk-select) component from the [component groups](/extensions/component-groups/about-component-groups) extension.
6666

6767
### Selection state
6868

@@ -84,4 +84,3 @@ The `useDataViewSelection` hook manages the selection state of the data view.
8484
```js file="./SelectionExample.tsx"
8585

8686
```
87-

0 commit comments

Comments
 (0)