Skip to content

Commit

Permalink
Merge pull request #7 from lionix-team/refactoring
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
GHarutyunyan authored Oct 20, 2019
2 parents b523b24 + 42a4fb7 commit a080ee6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,20 @@ or

## Customizations

You can customize your pagination styles by overwriting default values.
If you do not want to use icons or do not have the default icon source (mdi) used in the project,
you can pass false as the value of iconButtons
You can customize your pagination styles by overwriting default values.

Available props for component:

Prop Name | Default Value
------------- | -------------
containerClass | pagination
iconButtons | true
buttonIcons | false
prevButtonClass | page-item
prevButtonText | Prev
prevIconButton | mdi mdi-chevron-left
prevButtonIcon | fa fa-chevron-left
nextButtonClass | page-item
nextButtonText | Next
nextIconButton | mdi mdi-chevron-right
nextButtonIcon | fa fa-chevron-right
numberButtonClass | page-item
numberClass | page-link
numbersCountForShow | 2
Expand All @@ -130,8 +128,7 @@ You have to define here only props which you want to overwrite.
options:{
containerClass: "pagination-container",
prevButtonClass: "prev-button-class",
nextButtonText: "Next Page",
iconButtons: false,
nextButtonText: "Next Page"
...
}
```
Expand All @@ -146,7 +143,7 @@ params=()=>{
}
}
```
`<Pagination changePage={this.getData} data={data} options={options} iconButtons={false} requestParams={this.params()}/>`
`<Pagination changePage={this.getData} data={data} options={options} requestParams={this.params()}/>`

## Credits

Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/luilliarcec/react-laravel-paginex.git"
"url": "git+https://github.com/lionix-team/react-laravel-paginex.git"
},
"keywords": [
"laravel",
Expand All @@ -18,10 +18,6 @@
"paginate",
"lionix"
],
"author": {
"name": "Luis Arce",
"email": "[email protected]"
},
"contributors": [
{
"name": "Lionix Team",
Expand Down
20 changes: 10 additions & 10 deletions src/Pagination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ class Pagination extends Component {
// Generate Prev Icon Or Text Buttons
generateButtonsPrev = () => {
let options = this.state.options;
if (options.iconButtons) {
return <i className={options.prevIconButton}/>
if (options.buttonIcons) {
return <i className={options.prevButtonIcon}/>
}
return options.prevButtonText;
};

// Generate Next Icon Or Text Buttons
generateButtonsNext = () => {
let options = this.state.options;
if (options.iconButtons) {
return <i className={options.nextIconButton}/>
if (options.buttonIcons) {
return <i className={options.nextButtonIcon}/>
}
return options.nextButtonText;
};
Expand Down Expand Up @@ -153,13 +153,13 @@ class Pagination extends Component {
Pagination.defaultProps = {
options: {
containerClass: "pagination",
iconButtons: true,
buttonIcons: false,
prevButtonClass: "page-item",
prevButtonText: "Prev",
prevIconButton: "mdi mdi-chevron-left",
prevButtonIcon: "fa fa-chevron-left",
nextButtonClass: "page-item",
nextButtonText: "Next",
nextIconButton: "mdi mdi-chevron-right",
nextButtonIcon: "fa fa-chevron-right",
numberButtonClass: "page-item",
numberClass: "page-link",
numbersCountForShow: 2,
Expand All @@ -171,13 +171,13 @@ Pagination.defaultProps = {
Pagination.propTypes = {
options: PropTypes.shape({
containerClass: PropTypes.string,
iconButtons: PropTypes.bool,
buttonIcons: PropTypes.bool,
nextButtonClass: PropTypes.string,
nextButtonText: PropTypes.string,
nextIconButton: PropTypes.string,
nextButtonIcon: PropTypes.string,
prevButtonClass: PropTypes.string,
prevButtonText: PropTypes.string,
prevIconButton: PropTypes.string,
prevButtonIcon: PropTypes.string,
numberButtonClass: PropTypes.string,
numberClass: PropTypes.string,
numberCountForShow: PropTypes.number,
Expand Down

0 comments on commit a080ee6

Please sign in to comment.