Skip to content

Commit 7b112cb

Browse files
committed
apply review
1 parent 35fbc1d commit 7b112cb

File tree

3 files changed

+58
-53
lines changed

3 files changed

+58
-53
lines changed
Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,61 @@
11
.tooltip-wrapper {
2-
position: relative;
3-
4-
a.tooltip-target {
5-
color: inherit;
6-
text-decoration: underline dotted;
2+
position: relative;
3+
4+
a.tooltip-target {
5+
color: inherit;
6+
text-decoration: underline dotted;
7+
}
8+
9+
.tooltip {
10+
visibility: hidden;
11+
12+
display: flex;
13+
position: absolute;
14+
z-index: var(--site-z-floating);
15+
top: 100%;
16+
left: 50%;
17+
transform: translateX(-50%);
18+
19+
flex-flow: column nowrap;
20+
width: 16rem;
21+
22+
background: var(--site-raised-bgColor);
23+
border: 0.05rem solid rgba(0, 0, 0, .125);
24+
border-radius: 0.75rem;
25+
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, .15);
26+
padding: 0.8rem;
27+
28+
font-size: 1rem;
29+
font-weight: normal;
30+
font-style: normal;
31+
32+
.tooltip-header {
33+
font-size: 1.2rem;
34+
font-weight: 500;
35+
margin-bottom: 0.25rem;
736
}
837

9-
.tooltip {
10-
visibility: hidden;
11-
12-
display: flex;
13-
position: absolute;
14-
z-index: 100;
15-
top: 100%;
16-
left: 50%;
17-
transform: translateX(-50%);
18-
19-
flex-flow: column nowrap;
20-
width: 250px;
21-
22-
background: var(--site-raised-bgColor);
23-
border: 0.05rem solid rgba(0, 0, 0, .125);
24-
border-radius: 0.75rem;
25-
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, .15);
26-
padding: 0.8rem;
27-
28-
.tooltip-header {
29-
font-size: 1.2rem;
30-
font-weight: 500;
31-
margin-bottom: 0.25rem;
32-
}
33-
34-
.tooltip-content {
35-
font-size: 0.875rem;
36-
color: var(--site-secondary-textColor);
37-
}
38+
.tooltip-content {
39+
font-size: 0.875rem;
40+
color: var(--site-secondary-textColor);
3841
}
42+
}
3943

40-
// On non-touch devices, show tooltip on hover or focus.
41-
@media all and not (pointer: coarse) {
42-
&:hover .tooltip {
43-
visibility: visible;
44-
}
44+
// On non-touch devices, show tooltip on hover or focus.
45+
@media all and not (pointer: coarse) {
46+
&:hover .tooltip {
47+
visibility: visible;
48+
}
4549

46-
&:has(.tooltip-target:focus) .tooltip {
47-
visibility: visible;
48-
}
50+
&:focus-within .tooltip {
51+
visibility: visible;
4952
}
53+
}
5054

51-
// On touch devices, show tooltip on click (see global_scripts.dart).
52-
@media all and (pointer: coarse) {
53-
.tooltip.visible {
54-
visibility: visible;
55-
}
55+
// On touch devices, show tooltip on click (see global_scripts.dart).
56+
@media all and (pointer: coarse) {
57+
.tooltip.visible {
58+
visibility: visible;
5659
}
60+
}
5761
}

site/lib/src/extensions/glossary_link_processor.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:jaspr/jaspr.dart';
66
import 'package:jaspr_content/jaspr_content.dart';
77

88
import '../pages/glossary.dart';
9+
import '../util.dart';
910

1011
/// A node-processing, page extension for Jaspr Content that looks for links to
1112
/// glossary entries and enhances them with interactive glossary tooltips.
@@ -21,9 +22,7 @@ class GlossaryLinkProcessor implements PageExtension {
2122
List<Node> _processNodes(List<Node> nodes, Glossary glossary) {
2223
final processedNodes = <Node>[];
2324

24-
for (var i = 0; i < nodes.length; i++) {
25-
final node = nodes[i];
26-
25+
for (final node in nodes) {
2726
if (node is ElementNode &&
2827
node.tag == 'a' &&
2928
node.attributes['href']?.startsWith('/resources/glossary') == true) {
@@ -46,8 +45,10 @@ class GlossaryLinkProcessor implements PageExtension {
4645
[
4746
ElementNode('a', {
4847
...node.attributes,
49-
'class': '${node.attributes['class'] ?? ''} tooltip-target'
50-
.trim(),
48+
'class': [
49+
?node.attributes['class'],
50+
'tooltip-target',
51+
].toClasses,
5152
}, node.children),
5253
ComponentNode(GlossaryTooltip(entry: entry)),
5354
],

site/lib/src/style_hash.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// dart format off
33

44
/// The generated hash of the `main.css` file.
5-
const generatedStylesHash = '5w6vLV6V2ZWf';
5+
const generatedStylesHash = '39pNG/D9v051';

0 commit comments

Comments
 (0)