Skip to content

Commit 20d290c

Browse files
authored
Merge pull request #5 from fhlavac/layout
Set up DataView layout
2 parents d195a7a + 789eafd commit 20d290c

File tree

23 files changed

+306
-164
lines changed

23 files changed

+306
-164
lines changed

.gitignore

Lines changed: 32 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,38 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
.pnpm-debug.log*
9-
10-
# Diagnostic reports (https://nodejs.org/api/report.html)
11-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12-
13-
# Runtime data
14-
pids
15-
*.pid
16-
*.seed
17-
*.pid.lock
18-
19-
# Directory for instrumented libs generated by jscoverage/JSCover
20-
lib-cov
21-
22-
# Coverage directory used by tools like istanbul
1+
# Javascript builds
2+
node_modules
3+
dist
4+
tsc_out
5+
.out
6+
.changelog
7+
.DS_Store
238
coverage
24-
*.lcov
25-
26-
# nyc test coverage
27-
.nyc_output
28-
29-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30-
.grunt
31-
32-
# Bower dependency directory (https://bower.io/)
33-
bower_components
34-
35-
# node-waf configuration
36-
.lock-wscript
37-
38-
# Compiled binary addons (https://nodejs.org/api/addons.html)
39-
build/Release
40-
41-
# Dependency directories
42-
node_modules/
43-
jspm_packages/
44-
45-
# Snowpack dependency directory (https://snowpack.dev/)
46-
web_modules/
47-
48-
# TypeScript cache
49-
*.tsbuildinfo
50-
51-
# Optional npm cache directory
52-
.npm
53-
54-
# Optional eslint cache
9+
.cache
10+
results
11+
.tmp
5512
.eslintcache
13+
generated
5614

5715
# Cypress cache
5816
.cypress-cache
5917

60-
# Optional stylelint cache
61-
.stylelintcache
62-
63-
# Microbundle cache
64-
.rpt2_cache/
65-
.rts2_cache_cjs/
66-
.rts2_cache_es/
67-
.rts2_cache_umd/
68-
69-
# Optional REPL history
70-
.node_repl_history
71-
72-
# Output of 'npm pack'
73-
*.tgz
74-
75-
# Yarn Integrity file
76-
.yarn-integrity
77-
78-
# dotenv environment variable files
79-
.env
80-
.env.development.local
81-
.env.test.local
82-
.env.production.local
83-
.env.local
84-
85-
# parcel-bundler cache (https://parceljs.org/)
86-
.cache
87-
.parcel-cache
88-
89-
# Next.js build output
90-
.next
91-
out
92-
93-
# Nuxt.js build / generate output
94-
.nuxt
95-
dist
96-
97-
# Gatsby files
98-
.cache/
99-
# Comment in the public line in if your project uses Gatsby and not Next.js
100-
# https://nextjs.org/blog/next-9-1#public-directory-support
101-
# public
102-
103-
# vuepress build output
104-
.vuepress/dist
105-
106-
# vuepress v2.x temp and cache directory
107-
.temp
108-
.cache
109-
110-
# Docusaurus cache and generated files
111-
.docusaurus
112-
113-
# Serverless directories
114-
.serverless/
115-
116-
# FuseBox cache
117-
.fusebox/
118-
119-
# DynamoDB Local files
120-
.dynamodb/
121-
122-
# TernJS port file
123-
.tern-port
124-
125-
# Stores VSCode versions used for testing VSCode extensions
126-
.vscode-test
127-
128-
# yarn v2
129-
.yarn/cache
130-
.yarn/unplugged
131-
.yarn/build-state.yml
132-
.yarn/install-state.gz
133-
.pnp.*
18+
# package managers
19+
lerna-debug.log
20+
21+
# IDEs and editors
22+
.idea
23+
.project
24+
.classpath
25+
.c9
26+
*.launch
27+
.settings
28+
*.sublime-workspace
29+
.history
30+
.vscode
31+
.yo-rc.json
32+
33+
# IDE - VSCode
34+
.vscode
35+
# For vim
36+
*.swp
37+
38+
public

cypress/component/DataView.cy.tsx

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
import React from 'react';
2+
import { Pagination } from '@patternfly/react-core';
3+
import DataView from '../../packages/module/dist/dynamic/DataView';
4+
import DataViewToolbar from '../../packages/module/dist/esm/DataViewToolbar';
5+
6+
const PAGINATION = {
7+
page: 1,
8+
perPage: 1
9+
}
210

311
describe('DataView', () => {
4-
it('renders data view', () => {
5-
cy.mount(<div id="test">Some text</div>);
12+
it('renders the data view layout', () => {
13+
cy.mount(<DataView><>Data view content</></DataView>)
14+
cy.get('[data-ouia-component-id="DataView-stack-item-0"]').contains('Data view content');
15+
});
616

7-
cy.get('[id="test"]').should('contain', 'Some text');
8-
})
9-
})
17+
it('renders the data view with toolbar, data section and footer', () => {
18+
cy.mount(
19+
<DataView>
20+
<DataViewToolbar pagination={<Pagination {...PAGINATION} ouiaId="DataViewToolbar-pagination" />} />
21+
<>Data section</>
22+
<DataViewToolbar pagination={<Pagination isCompact {...PAGINATION} ouiaId="DataViewFooter-pagination" />} ouiaId="DataViewFooter" />
23+
</DataView>
24+
);
25+
cy.get('[data-ouia-component-id="DataViewToolbar-pagination"]').should('exist');
26+
cy.get('[data-ouia-component-id="DataView-stack-item-1"]').contains('Data section');
27+
cy.get('[data-ouia-component-id="DataViewFooter-pagination"]').should('exist');
28+
});
29+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import { Pagination } from '@patternfly/react-core';
3+
import DataViewToolbar from '../../packages/module/dist/dynamic/DataViewToolbar';
4+
5+
describe('DataViewToolbar', () => {
6+
it('renders the data view toolbar', () => {
7+
cy.mount(<DataViewToolbar pagination={<Pagination page={1} perPage={10} ouiaId="DataViewToolbar-pagination" />} />)
8+
cy.get('[data-ouia-component-id="DataViewToolbar"]').should('exist');
9+
cy.get('[data-ouia-component-id="DataViewToolbar-pagination"]').should('exist');
10+
});
11+
});

cypress/e2e/DataView.spec.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('Test the Data view docs page', () => {
22

3-
it('renders the docs', () => {
3+
it.skip('renders the docs', () => {
44
cy.visit('http://localhost:8006/extensions/data-view/data-view');
55
})
66
})

package-lock.json

Lines changed: 39 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/module/generate-index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ async function generateIndex(files) {
2020

2121
files.forEach(file => {
2222
const name = file.replace('/index.ts', '').split('/').pop();
23-
stream.write(`\nexport { default as ${name} } from './${name}';\n`);
23+
// do not generate default exports for Hooks/
24+
name !== 'Hooks' && stream.write(`\nexport { default as ${name} } from './${name}';\n`);
2425
stream.write(`export * from './${name}';\n`);
2526
});
2627
stream.end();

packages/module/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
"tag": "prerelease"
3232
},
3333
"dependencies": {
34-
"@patternfly/react-core": "^6.0.0-alpha.50",
34+
"@patternfly/react-core": "^6.0.0-alpha.55",
3535
"@patternfly/react-icons": "^6.0.0-alpha.20",
36+
"@patternfly/react-table": "^6.0.0-alpha.55",
3637
"react-jss": "^10.10.0",
3738
"clsx": "^2.1.1"
3839
},

packages/module/patternfly-a11y.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ module.exports = {
2222
'color-contrast',
2323
'landmark-no-duplicate-main',
2424
'landmark-main-is-top-level',
25-
'scrollable-region-focusable'
25+
'scrollable-region-focusable',
26+
'link-in-text-block',
2627
].join(','),
2728
ignoreIncomplete: true
2829
};

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,32 @@ section: extensions
55
subsection: Data view
66
# Sidenav secondary level section
77
# should be the same for all markdown files
8-
id: Data view
8+
id: Data view layout
99
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
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
1313
propComponents: ['DataView']
1414
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md
1515
---
16-
16+
import { Pagination } from '@patternfly/react-core';
1717
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
18+
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
1819

1920
The **data view** component renders record data in a configured layout.
2021

21-
### Basic example
22+
### Layout example
23+
24+
Data view is expected to consist of header, data part and footer stacked below each other and passed as `children`.
25+
26+
```js file="./DataViewLayoutExample.tsx"
27+
28+
```
29+
30+
### Predefined layout components
2231

23-
A blank example of the data view layout.
32+
You can make use of the predefined layout components to display a default header and footer. See [data view toolbar](/data-view/data-view-toolbar) for more information
2433

25-
```js file="./DataViewExample.tsx"
34+
```js file="./DataViewPredefinedLayoutExample.tsx"
2635

2736
```

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

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

0 commit comments

Comments
 (0)