Skip to content

Commit e5aa919

Browse files
committed
Init
1 parent 6b8cf86 commit e5aa919

21 files changed

+1136
-70
lines changed

cypress/component/SkeletonTable.cy.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Th } from '@patternfly/react-table';
2+
import { Th, RowSelectVariant } from '@patternfly/react-table';
33
import SkeletonTable from '../../packages/module/dist/dynamic/SkeletonTable';
44

55
describe('SkeletonTable', () => {
@@ -15,7 +15,7 @@ describe('SkeletonTable', () => {
1515
});
1616

1717
it ('can be used without passing columns', () => {
18-
const SkeletonTableExample = <SkeletonTable rows={10} numberOfColumns={2} />;
18+
const SkeletonTableExample = <SkeletonTable rows={10} columnsCount={2} />;
1919
cy.mount(SkeletonTableExample);
2020
cy.get('table').should('exist');
2121
cy.get('table thead tr').should('have.text', '');
@@ -38,7 +38,7 @@ describe('SkeletonTable', () => {
3838
});
3939

4040
it('can be passed a selectVariant to render radio buttons', () => {
41-
const SkeletonTableExample = <SkeletonTable rows={10} columns={[ 'first', 'second' ]} isSelectable selectVariant="radio" />;
41+
const SkeletonTableExample = <SkeletonTable rows={10} columns={[ 'first', 'second' ]} isSelectable selectVariant={RowSelectVariant.radio} />;
4242
cy.mount(SkeletonTableExample);
4343
cy.get('table').should('exist');
4444
cy.get('table thead tr').should('have.text', 'firstsecond');
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import { RowSelectVariant } from '@patternfly/react-table';
3+
import SkeletonTableBody from '../../packages/module/dist/dynamic/SkeletonTableBody';
4+
5+
describe('SkeletonTableBody', () => {
6+
beforeEach(() => {
7+
cy.viewport(1600, 800);
8+
});
9+
10+
it('renders SkeletonTableBody', () => {
11+
const SkeletonTableExample = <SkeletonTableBody rowsCount={10} columnsCount={2} />;
12+
cy.mount(SkeletonTableExample);
13+
cy.get('div[class="pf-v5-c-skeleton"]').should('have.length', 20);
14+
});
15+
16+
it('contains checkboxes when passed isSelectable', () => {
17+
cy.mount(<SkeletonTableBody rowsCount={10} columnsCount={2} isSelectable />);
18+
cy.get('input[type="checkbox"]').should('have.length', 10);
19+
});
20+
21+
it('is expandable when passed isExpandable', () => {
22+
cy.mount(<SkeletonTableBody rowsCount={10} columnsCount={2} isExpandable />);
23+
cy.get('.pf-v5-c-table__toggle-icon').should('have.length', 10);
24+
});
25+
26+
it('can be passed a selectVariant to render radio buttons', () => {
27+
cy.mount(<SkeletonTableBody rowsCount={10} columnsCount={2} isSelectable selectVariant={RowSelectVariant.radio} />);
28+
cy.get('input[type="radio"]').should('have.length', 10);
29+
});
30+
});

packages/module/patternfly-docs/content/extensions/component-groups/examples/Skeleton/SkeletonTableCompactExample.tsx

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/module/patternfly-docs/content/extensions/component-groups/examples/Skeleton/SkeletonTableExample.tsx

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/module/patternfly-docs/content/extensions/component-groups/examples/Skeleton/SkeletonTableExpandableExample.tsx

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/module/patternfly-docs/content/extensions/component-groups/examples/Skeleton/SkeletonTableSelectableExample.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/module/patternfly-docs/content/extensions/component-groups/examples/Skeleton/Skeleton.md renamed to packages/module/patternfly-docs/content/extensions/component-groups/examples/SkeletonTable/SkeletonTable.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ id: Skeleton table
1010
source: react
1111
# If you use typescript, the name of the interface to display props for
1212
# These are found through the sourceProps function provided in patternfly-docs.source.js
13-
propComponents: ['SkeletonTable']
14-
sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packages/module/patternfly-docs/content/extensions/component-groups/examples/Skeleton/Skeleton.md
13+
propComponents: ['SkeletonTable', 'SkeletonTableBody']
14+
sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packages/module/patternfly-docs/content/extensions/component-groups/examples/SkeletonTable/SkeletonTable.md
1515
---
16+
import { RowSelectVariant, TableVariant, Table } from '@patternfly/react-table';
1617
import SkeletonTable from '@patternfly/react-component-groups/dist/dynamic/SkeletonTable';
18+
import SkeletonTableBody from '@patternfly/react-component-groups/dist/dynamic/SkeletonTableBody';
1719

1820
The **skeleton table** component is used to display placeholder "skeletons" within a table as its contents load.
1921

@@ -69,3 +71,11 @@ To simulate this loading process, select the `Reload table` button and wait for
6971
```js file="./SkeletonTableLoadingExample.tsx"
7072

7173
```
74+
75+
### Skeleton table body
76+
77+
You can also render only the `<Tbody>` part of the skeleton table by using the `<SkeletonTableBody/>` instead of `<SkeletonTable/>`. This can be especially useful for usage inside the data view extension.
78+
79+
```js file="./SkeletonTableBodyExample.tsx"
80+
81+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import { Table } from '@patternfly/react-table';
3+
import SkeletonTableBody from "@patternfly/react-component-groups/dist/dynamic/SkeletonTableBody";
4+
5+
export const SkeletonTableBodyExample: React.FC = () => (
6+
<Table>
7+
<SkeletonTableBody isSelectable rowsCount={5} columnsCount={2} />
8+
</Table>
9+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
import SkeletonTable from "@patternfly/react-component-groups/dist/dynamic/SkeletonTable";
3+
import { TableVariant } from '@patternfly/react-table';
4+
5+
export const SkeletonTableExample: React.FC = () => <SkeletonTable rowsCount={10} columns={[ 'first', 'second' ]} variant={TableVariant.compact} borders={false} />;

packages/module/patternfly-docs/content/extensions/component-groups/examples/Skeleton/SkeletonTableCustomExample.tsx renamed to packages/module/patternfly-docs/content/extensions/component-groups/examples/SkeletonTable/SkeletonTableCustomExample.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React from 'react';
2-
import SkeletonTable from '@patternfly/react-core/dist/js/components/Skeleton/SkeletonTable';
3-
import { Th } from '@patternfly/react-table';
2+
import SkeletonTable from "@patternfly/react-component-groups/dist/dynamic/SkeletonTable";import { Th } from '@patternfly/react-table';
43

54
export const SkeletonTableExample: React.FC = () => (
65
<SkeletonTable
7-
rowSize={10}
6+
rowsCount={10}
87
columns={[
98
<Th key="1" sort={{ columnIndex: 0, sortBy: {} }}>
109
first

0 commit comments

Comments
 (0)