Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
feat: EC pagination - INNO-1355 (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
emeryro authored and planctus committed Mar 12, 2019
1 parent daeadd3 commit a6cf03a
Show file tree
Hide file tree
Showing 10 changed files with 709 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ec/packages/ec-component-pagination/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__snapshots__
docs
*.story.js
*.test.js
**/*.md
83 changes: 83 additions & 0 deletions src/ec/packages/ec-component-pagination/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# ECL Twig - EC Pagination component

npm package: `@ecl-twig/ec-component-pagination`

```shell
npm install --save @ecl-twig/ec-component-pagination
```

## Parameters

- "label" (string) (default: ''): for screen reader
- "items" (array) (default: []):
- "type" (string) (default: ''): could be 'previous', 'current' or 'next'
- "label" (string) (default: ''): label used when the item is not a link
- "aria_label" (string) (default: '')
- "link" (object) (default: ''): object of type Link
- "extra_classes" (optional) (string) (default: '')
- "extra_attributes" (optional) (array) (default: [])
- "name" (string) Attribute name, eg. 'data-test'
- "value" (string) Attribute value, eg: 'data-test-1'

## Example:

<!-- prettier-ignore -->
```twig
{% include 'path/to/pagination.html.twig' with {
label: 'Pagination',
items: [
{
type: 'previous',
aria-label: 'Go to previous page',
link: {
link: {
path: '/example#previous',
label: 'Previous',
icon_position: 'before',
}
icon: {
path: 'path/to/icons.svg',
type: 'ui',
name: 'corner-arrow',
size: 'xs',
transform: 'rotate-270',
},
},
},
{
aria-label: 'Go to page 24',
link: {
link: {
path: '/example#page-24',
label: '24',
},
},
},
...
{
type: 'current',
aria-label: 'Page 26',
label: '26',
},
...
{
type: 'next',
aria-label: 'Go to next page',
link: {
link: {
path: '/example#next',
label: 'Next',
icon_position: 'after',
}
icon: {
path: 'path/to/icons.svg',
type: 'ui',
name: 'corner-arrow',
size: 'xs',
transform: 'rotate-90',
},
},
},
],
} %}
```
Loading

0 comments on commit a6cf03a

Please sign in to comment.