Skip to content

Commit a8ba5f2

Browse files
authored
Introduce more standard next and prev page buttons (#6572)
Updates the previous and next page buttons to be consistent with docs.flutter.dev and more consistent with other documentation sites. **After:** <img width="440" alt="Screenshot of previous and next page buttons after the change" src="https://github.com/user-attachments/assets/4b40354b-c24a-4b71-98e5-eade7745d108" /> **Before:** <img width="440" alt="Screenshot of previous and next page buttons before the change" src="https://github.com/user-attachments/assets/e22e99b3-48e4-4070-bd69-a3826bd67036" /> **Staged:** https://dart-dev--pr6572-feat-next-prev-buttons-gz3jkrbt.web.app/language/functions#external
1 parent 4e84699 commit a8ba5f2

File tree

4 files changed

+88
-43
lines changed

4 files changed

+88
-43
lines changed

src/_includes/prev-next.html

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
{% if nextpage.url or prevpage.url %}
2-
<nav id="prev-next">
3-
<ul>
4-
<li class="previous">
5-
{% if prevpage.url %}
6-
<a href="{{prevpage.url}}">&lang;&nbsp;&nbsp;{{prevpage.title}}</a>
7-
{% endif %}
8-
</li>
9-
<li class="next">
10-
{% if nextpage.url %}
11-
<a href="{{nextpage.url}}">{{nextpage.title}}&nbsp;&nbsp;&rang;</a>
12-
{% endif %}
13-
</li>
14-
</ul>
1+
{% if nextpage or prevpage -%}
2+
<nav id="site-prev-next">
3+
{% if prevpage.url -%}
4+
<a class="prev" href="{{ prevpage.url }}">
5+
<span class="material-symbols" aria-hidden="true">chevron_left</span>
6+
<div>
7+
<span class="prev-next-subtitle" aria-label="Previous page: ">Previous</span>
8+
<span class="prev-next-title">{{ prevpage.title}}</span>
9+
</div>
10+
</a>
11+
{% endif -%}
12+
{% if nextpage.url -%}
13+
<a class="next" href="{{ nextpage.url }}">
14+
<div>
15+
<span class="prev-next-subtitle" aria-label="Next page: ">Next</span>
16+
<span class="prev-next-title">{{ nextpage.title}}</span>
17+
</div>
18+
<span class="material-symbols" aria-hidden="true">chevron_right</span>
19+
</a>
20+
{% endif -%}
1521
</nav>
16-
{% endif %}
22+
{% endif -%}

src/_sass/_site.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
@use 'components/header';
2525
@use 'components/linter-rules';
2626
@use 'components/misc';
27+
@use 'components/next-prev-nav';
2728
@use 'components/os-tabs';
28-
@use 'components/pagination';
2929
@use 'components/search';
3030
@use 'components/sidenav';
3131
@use 'components/tags';
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
@use '../base/mixins';
2+
@use '../base/variables' as *;
3+
4+
#site-prev-next {
5+
display: flex;
6+
flex-direction: row;
7+
flex-wrap: wrap;
8+
justify-content: space-between;
9+
gap: 1rem;
10+
margin-block-end: 1rem;
11+
font-family: $site-font-family-alt;
12+
13+
.prev {
14+
text-align: left;
15+
justify-content: flex-start;
16+
}
17+
18+
.next {
19+
text-align: right;
20+
justify-content: flex-end;
21+
margin-left: auto;
22+
}
23+
24+
@media (min-width: 576px) {
25+
flex-wrap: nowrap;
26+
27+
.prev, .next {
28+
max-width: 50%;
29+
}
30+
}
31+
32+
a {
33+
overflow-x: hidden;
34+
flex-basis: 100%;
35+
36+
text-decoration: none;
37+
color: $site-color-body;
38+
border: 1px solid rgba(194, 198, 214, .75);
39+
border-radius: 0.25rem;
40+
41+
display: flex;
42+
flex-direction: row;
43+
align-items: center;
44+
padding: 0.5rem;
45+
min-height: 100%;
46+
47+
> div {
48+
display: flex;
49+
flex-direction: column;
50+
padding: 0.5rem;
51+
52+
.prev-next-subtitle {
53+
font-size: 0.75rem;
54+
line-height: 0.75rem;
55+
}
56+
}
57+
58+
&:hover {
59+
@include mixins.interaction-style(3%);
60+
}
61+
62+
&:active {
63+
@include mixins.interaction-style(5%);
64+
}
65+
}
66+
}

src/_sass/components/_pagination.scss

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

0 commit comments

Comments
 (0)