Skip to content

Commit a0f612f

Browse files
committed
Refactor previous and next page anchors
1 parent 491c6e9 commit a0f612f

File tree

4 files changed

+51
-22
lines changed

4 files changed

+51
-22
lines changed

docs/_layouts/static-site-main.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@
3636
{{ content }}
3737
<nav class="arrows-wrapper" aria-label="Page navigation">
3838
{% if page.previous %}
39-
<a rel="prev" href="{{ page.previous }}" class="arrows previous" aria-keyshortcuts="Left">
39+
<a rel="prev" href="{{ page.previous.url }}" class="arrows previous" aria-keyshortcuts="Left">
40+
<span>{{ page.previous.title }}</span>
4041
<i class="fa fa-angle-left"></i>
4142
</a>
4243
{% endif %}
4344
{% if page.next %}
44-
<a rel="next" href="{{ page.next }}" class="arrows next" aria-keyshortcuts="Right">
45+
<a rel="next" href="{{ page.next.url }}" class="arrows next" aria-keyshortcuts="Right">
46+
<span>{{ page.previous.title }}</span>
4547
<i class="fa fa-angle-right"></i>
4648
</a>
4749
{% endif %}

project/resources/referenceReplacements/_layouts/static-site-main.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131
{{ content }}
3232
<nav class="arrows-wrapper" aria-label="Page navigation">
3333
{% if page.previous %}
34-
<a rel="prev" href="{{ page.previous }}" class="arrows previous" aria-keyshortcuts="Left">
34+
<a rel="prev" href="{{ page.previous.url }}" class="arrows previous" aria-keyshortcuts="Left">
35+
<span>{{ page.previous.title }}</span>
3536
<i class="fa fa-angle-left"></i>
3637
</a>
3738
{% endif %}
3839
{% if page.next %}
39-
<a rel="next" href="{{ page.next }}" class="arrows next" aria-keyshortcuts="Right">
40+
<a rel="next" href="{{ page.next.url }}" class="arrows next" aria-keyshortcuts="Right">
41+
<span>{{ page.next.title }}</span>
4042
<i class="fa fa-angle-right"></i>
4143
</a>
4244
{% endif %}

scaladoc/resources/dotty_res/styles/scalastyle.css

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,23 +1118,32 @@ footer .socials {
11181118

11191119
/* Nav Icons */
11201120

1121+
.arrows-wrapper {
1122+
display: flex;
1123+
justify-content: space-between;
1124+
padding-top: 10px;
1125+
}
1126+
11211127
.arrows {
1122-
font-size: 3em;
1128+
color: var(--link-fg);
1129+
font-size: 1em;
11231130
text-align: center;
11241131

1125-
position: fixed;
1126-
top: 0;
1127-
bottom: 0;
1128-
margin: 0;
1129-
max-width: 150px;
1130-
min-width: 90px;
1131-
11321132
display: flex;
1133-
justify-content: center;
1134-
flex-direction: column;
1133+
align-items: center;
11351134

11361135
transition: color 0.5s, background-color 0.5s;
1137-
z-index: 3;
1136+
}
1137+
1138+
.arrows span {
1139+
max-width: 10vw;
1140+
overflow: hidden;
1141+
white-space: nowrap;
1142+
text-overflow: ellipsis;
1143+
}
1144+
1145+
.arrows i {
1146+
margin: 8px;
11381147
}
11391148

11401149
.arrows.previous, .arrows.next {
@@ -1143,19 +1152,16 @@ footer .socials {
11431152

11441153
.arrows:hover {
11451154
text-decoration: none;
1146-
color: var(--grey300);
1147-
background-color: var(--grey900);
1155+
color: var(--link-hover-fg);
11481156
transition: background-color 0.15s, color 0.15s;
11491157
}
11501158

11511159
.previous {
1152-
left: var(--side-width);
1153-
float: left;
1160+
flex-direction: row-reverse;
11541161
}
11551162

11561163
.next {
1157-
right: 0;
1158-
float: right;
1164+
flex-direction: row;
11591165
}
11601166

11611167
@media screen and (max-width: 1000px) {

scaladoc/src/dotty/tools/scaladoc/renderers/Renderer.scala

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,26 @@ abstract class Renderer(rootPackage: Member, val members: Map[DRI, Member], prot
5959
val realSiblingPath = realPath(n.file.toPath)
6060
realMidPath.relativize(realSiblingPath).toString.stripPrefix("../")
6161
}
62-
List(link(prev).map("previous" -> _), link(next).map("next" -> _)).flatten.toMap
62+
List(
63+
for {
64+
link <- link(prev)
65+
p <- prev
66+
} yield (
67+
"previous" -> Map(
68+
"title" -> p.templateFile.title.name,
69+
"url" -> link
70+
)
71+
),
72+
for {
73+
link <- link(next)
74+
n <- next
75+
} yield (
76+
"next" -> Map(
77+
"title" -> n.templateFile.title.name,
78+
"url" -> link
79+
)
80+
),
81+
).flatten.toMap
6382
}.toList
6483

6584
def updateSettings(templates: Seq[LoadedTemplate], additionalSettings: ListBuffer[Map[String, Object]]): List[LoadedTemplate] =

0 commit comments

Comments
 (0)