File tree Expand file tree Collapse file tree 3 files changed +65
-47
lines changed Expand file tree Collapse file tree 3 files changed +65
-47
lines changed Original file line number Diff line number Diff line change 11<div class =" pagination-wrapper" >
2- {{ #if @previous }}
3- <div class =" previous-wrapper bg-none" >
4- <LinkTo class =" pagination-link previous" @route ={{ @previous.route }} @model ={{ @previous.model }} >
5- <span class =" pagination-text" >{{ @previous.text }} </span >
6- </LinkTo >
2+ {{ #if (has-block " previous" )}}
3+ <div class =" previous-wrapper" >
4+ {{ yield to =' previous' }}
75 </div >
86 {{ /if }}
97
10- {{ #if @next }}
11- <div class =" next-wrapper bg-none" >
12- <LinkTo class =" pagination-link next" @route ={{ @next.route }} @model ={{ @next.model }} >
13- <span class =" pagination-text" >{{ @next.text }} </span >
14- </LinkTo >
8+ {{ #if (has-block " next" )}}
9+ <div class =" next-wrapper" >
10+ {{ yield to =' next' }}
1511 </div >
1612 {{ /if }}
1713</div >
Original file line number Diff line number Diff line change 66 gap : 0px 40px ;
77 grid-template-areas :
88 "previous next" ;
9- }
9+ & > .previous-wrapper {
10+ grid-area : previous;
11+ & ::before {
12+ content : "\2039" ;
13+ }
1014
11- .previous-wrapper {
12- grid-area : previous;
13- }
15+ & : hover ::before {
16+ transform : translateX (-0.5em );
17+ color : var (--color-link-hover );
18+ }
19+ }
1420
15- .next-wrapper {
16- grid-area : next;
17- text-align : right;
18- }
21+ & > .next-wrapper {
22+ grid-area : next;
23+ text-align : right;
24+ & ::after {
25+ content : "\203A" ;
26+ }
1927
20- .pagination-link {
21- & ::before ,
22- & ::after {
23- display : inline-block;
24- font-weight : 700 ;
25- margin : 0 0.5em ;
26- transition : transform 0.3s ;
27- }
28- & : hover , & : focus , & : active {
29- .pagination-text {
28+ & : hover ::after {
29+ transform : translateX (0.5em );
3030 color : var (--color-link-hover );
3131 }
3232 }
33- }
3433
35- .pagination-text {
36- color : var (--color-link );
37- background : no-repeat left bottom
38- linear-gradient (var (--color-brand-40 ), var (--color-brand-40 ));
39- background-size : 100% 0.1875rem ;
34+ & > .previous-wrapper , & > .next-wrapper {
35+ & ::before ,
36+ & ::after {
37+ color : var (--color-link );
38+ display : inline-block;
39+ font-weight : 700 ;
40+ margin : 0 0.5em ;
41+ transition : transform 0.3s ;
42+ }
43+ }
4044}
4145
46+
47+
4248.previous {
4349 & ::before {
4450 content : "\2039" ;
Original file line number Diff line number Diff line change 11# Pagination
22
3- Adds back and forth pagination, when provided with a ` previous ` object and a ` next ` object. These objects should look like this:
4- ``` js
5- const object = {
6- route: " String" ,
7- model: {},
8- text: " The text that will show in the pagination"
9- }
10- ```
3+ Adds back and forth pagination, using ` named blocks ` . You insert your previous link into a ` <:previous></:previous> ` block and the next link into a ` <:next></:next> ` block. This will add the underline styling to the link and an animated arrow to your link.
114
125## Usage
136
147Add the following code to the template
158
169``` handlebars
17- <EsPagination @previous={{hash text="Older articles" route="prev"}} @next={{hash text="Newer articles" route="next"}}/>
10+ <EsPagination>
11+ <:previous>
12+ <LinkTo @route="page" @model={{this.previousId}}>
13+ Newer articles
14+ </LinkTo>
15+ </:previous>
16+ <:next>
17+ <LinkTo @route="page" @model={{this.nextId}}>
18+ Older articles
19+ </LinkTo>
20+ </:next>
21+ </EsPagination>
1822```
1923
20- The example below show what happens if you only provide the ` previous ` object when it's the last page you are on.
24+ The example below show what happens if you only provide the ` previous ` block when it's the last page you are on.
2125
2226``` handlebars
23- <EsPagination @previous={{hash text="One before last article" route="prev"}}/>
27+ <EsPagination>
28+ <:previous>
29+ <LinkTo @route="page" @model={{this.previousId}}>
30+ Newer articles
31+ </LinkTo>
32+ </:previous>
33+ </EsPagination>
2434```
25- The example below show what happens if you only provide the ` next ` object when it's the first page you are on.
35+ The example below show what happens if you only provide the ` next ` block when it's the first page you are on.
2636
2737``` handlebars
28- <EsPagination @next={{hash text="Second article" route="next"}}/>
38+ <EsPagination>
39+ <:next>
40+ <LinkTo @route="page" @model={{this.nextId}}>
41+ Older articles
42+ </LinkTo>
43+ </:next>
44+ </EsPagination>
2945```
You can’t perform that action at this time.
0 commit comments