This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added examples for page label and page count
- Loading branch information
SM051274
committed
Sep 28, 2023
1 parent
904a038
commit 5fd4d93
Showing
4 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...s/src/terra-dev-site/doc/paginator/example/ProgressivePaginatorCustomPageCountExample.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react'; | ||
import Dialog from 'terra-dialog'; | ||
import ProgressivePaginator from 'terra-paginator/lib/ProgressivePaginator'; | ||
import classNames from 'classnames/bind'; | ||
import styles from './PaginatorExampleCommon.module.scss'; | ||
|
||
const cx = classNames.bind(styles); | ||
const totalCount = 450; | ||
|
||
const buildPage = () => { | ||
const fullContent = [<p>Patients are requesting greater affordability and efficiency in healthcare. With procedures performed in an ambulatory surgery center costing up to 60% less compared to a hospital outpatient department (1), the demand for these facilities is increasing. In fact, the U.S. ambulatory surgery center market is expected to see a 6.9 % compound annual growth rate, reaching $33 billion by 2028. (2) Cerner understands the urgency to grow in the ambulatory surgery center market while continuing to deliver excellent care. Healthcare IT products can help improve clinician efficiency and patient outcomes, as well as enhance communication and data exchange between ambulatory surgery center providers and patients.</p>]; | ||
|
||
return ( | ||
fullContent | ||
); | ||
}; | ||
|
||
class ProgressivePaginatorCustomPageCountExample extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
content: buildPage(), | ||
currentPage: 1, | ||
pageLabel: `Summary 1 in ${totalCount}`, | ||
}; | ||
|
||
this.changePages = this.changePages.bind(this); | ||
} | ||
|
||
changePages(index) { | ||
this.setState({ currentPage: index }); | ||
this.setState({ pageLabel: `Summary ${index} of total ${totalCount}` }); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className={cx('paginator-wrapper')}> | ||
<Dialog | ||
header={( | ||
<h1 id="progressive_paginator_header_id"> | ||
Progressive Paginator With Custom PageLabel and Page Count | ||
</h1> | ||
)} | ||
// eslint-disable-next-line react/prop-types | ||
footer={<ProgressivePaginator onPageChange={this.changePages} selectedPage={this.state.currentPage} totalCount={totalCount} itemCountPerPage={10} ariaLabelledBy="progressive_paginator_header_id" pageLabel={this.state.pageLabel} hidePageCount />} | ||
> | ||
{this.state.content} | ||
</Dialog> | ||
<b>Note: Ensure translated string is provided for pageLabel to make it accessible in different locales</b> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default ProgressivePaginatorCustomPageCountExample; |
55 changes: 55 additions & 0 deletions
55
...s/src/terra-dev-site/doc/paginator/example/ProgressivePaginatorCustomPageLabelExample.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react'; | ||
import Dialog from 'terra-dialog'; | ||
import ProgressivePaginator from 'terra-paginator/lib/ProgressivePaginator'; | ||
import classNames from 'classnames/bind'; | ||
import styles from './PaginatorExampleCommon.module.scss'; | ||
|
||
const cx = classNames.bind(styles); | ||
const totalCount = 450; | ||
const pageLabel = 'Summary'; | ||
|
||
const buildPage = () => { | ||
const fullContent = [<p>Patients are requesting greater affordability and efficiency in healthcare. With procedures performed in an ambulatory surgery center costing up to 60% less compared to a hospital outpatient department (1), the demand for these facilities is increasing. In fact, the U.S. ambulatory surgery center market is expected to see a 6.9 % compound annual growth rate, reaching $33 billion by 2028. (2) Cerner understands the urgency to grow in the ambulatory surgery center market while continuing to deliver excellent care. Healthcare IT products can help improve clinician efficiency and patient outcomes, as well as enhance communication and data exchange between ambulatory surgery center providers and patients.</p>]; | ||
|
||
return ( | ||
fullContent | ||
); | ||
}; | ||
|
||
class ProgressivePaginatorCustomPageLabelExample extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
content: buildPage(), | ||
currentPage: 1, | ||
}; | ||
|
||
this.changePages = this.changePages.bind(this); | ||
} | ||
|
||
changePages(index) { | ||
this.setState({ currentPage: index }); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className={cx('paginator-wrapper')}> | ||
<Dialog | ||
header={( | ||
<h1 id="progressive_paginator_header_id"> | ||
Progressive Paginator With Custom Page Label | ||
</h1> | ||
)} | ||
// eslint-disable-next-line react/prop-types | ||
footer={<ProgressivePaginator onPageChange={this.changePages} selectedPage={this.state.currentPage} totalCount={totalCount} itemCountPerPage={10} ariaLabelledBy="progressive_paginator_header_id" pageLabel={pageLabel} />} | ||
> | ||
{this.state.content} | ||
</Dialog> | ||
<b>Note: Ensure translated string is provided for pageLabel to make it accessible in different locales</b> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default ProgressivePaginatorCustomPageLabelExample; |