Skip to content

Commit 7d21efe

Browse files
committed
refactor to more idiomatic jaspr code
1 parent d731338 commit 7d21efe

25 files changed

+675
-497
lines changed

site/lib/_sass/_site.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
@use 'components/misc';
3030
@use 'components/next-prev-nav';
3131
@use 'components/os-selector';
32+
@use 'components/pagenav';
3233
@use 'components/pill';
3334
@use 'components/quiz';
3435
@use 'components/sidebar';
3536
@use 'components/side-menu';
3637
@use 'components/site-switcher';
3738
@use 'components/tabs';
3839
@use 'components/theming';
39-
@use 'components/toc';
4040
@use 'components/tooltip';
4141
@use 'components/trailing';
4242

site/lib/_sass/components/_header.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,26 @@ body.open_menu #menu-toggle span.material-symbols {
167167
}
168168
}
169169
}
170+
171+
#site-subheader {
172+
display: flex;
173+
flex-direction: row;
174+
flex-wrap: wrap;
175+
align-items: center;
176+
177+
position: sticky;
178+
top: var(--site-header-height);
179+
z-index: var(--site-z-subheader);
180+
height: var(--site-subheader-height);
181+
182+
font-family: var(--site-ui-fontFamily);
183+
font-size: 0.875rem;
184+
185+
background-color: var(--site-base-bgColor);
186+
border-bottom: 0.1rem solid var(--site-outline-variant);
187+
box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
188+
189+
@media (width < 240px), (width >= 1200px) {
190+
display: none;
191+
}
192+
}

site/lib/_sass/components/_toc.scss renamed to site/lib/_sass/components/_pagenav.scss

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,4 @@
1-
#toc-top {
2-
font-family: var(--site-ui-fontFamily);
3-
4-
display: none;
5-
flex-direction: row;
6-
flex-wrap: wrap;
7-
justify-content: space-between;
8-
align-content: center;
9-
height: var(--site-subheader-height);
10-
11-
@media (min-width: 240px) {
12-
display: flex;
13-
}
14-
15-
@media (min-width: 1200px) {
16-
display: none;
17-
}
18-
19-
position: sticky;
20-
top: var(--site-header-height);
21-
22-
background-color: var(--site-base-bgColor);
23-
border-bottom: 0.1rem solid var(--site-outline-variant);
24-
box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
25-
26-
font-size: 0.875rem;
27-
z-index: var(--site-z-subheader);
1+
#pagenav {
282

293
>button.dropdown-button {
304
display: flex;
@@ -58,25 +32,21 @@
5832
}
5933

6034
.toc-current {
61-
flex-wrap: nowrap;
62-
white-space: nowrap;
63-
overflow: hidden;
64-
6535
display: none;
6636

6737
@media (min-width: 320px) {
6838
display: flex;
6939
}
70-
}
71-
72-
#current-header {
73-
color: var(--site-base-fgColor-alt);
7440

41+
flex-wrap: nowrap;
42+
white-space: nowrap;
7543
overflow: hidden;
7644
text-overflow: ellipsis;
45+
46+
color: var(--site-base-fgColor-alt);
7747
}
7848

79-
.dropdown-content {
49+
#pagenav-content {
8050
position: absolute;
8151
box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
8252
border-bottom: 0.1rem solid var(--site-outline-variant);
@@ -106,7 +76,7 @@
10676
max-width: 24rem;
10777
}
10878

109-
>a {
79+
a#return-to-top {
11080
margin: 0.4rem 0;
11181
padding: 0.1rem;
11282
font-size: 1rem;
@@ -134,7 +104,7 @@
134104
}
135105
}
136106

137-
>nav {
107+
nav {
138108
padding: 0.6rem 0 0.8rem;
139109
}
140110
}

site/lib/_sass/components/_side-menu.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.styled-toc-list {
1+
.toc-list {
22
margin: 0;
33
--toc-indent: 0;
44

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.tooltip-wrapper {
22
position: relative;
33

4-
a.tooltip-target {
4+
.tooltip-target a {
55
color: inherit;
66
text-decoration: underline;
77
text-decoration-style: dotted;
@@ -10,14 +10,13 @@
1010
.tooltip {
1111
visibility: hidden;
1212

13-
display: flex;
13+
display: block;
1414
position: absolute;
1515
z-index: var(--site-z-floating);
1616
top: 100%;
1717
left: 50%;
1818
transform: translateX(-50%);
1919

20-
flex-flow: column nowrap;
2120
width: 16rem;
2221

2322
background: var(--site-raised-bgColor);
@@ -26,20 +25,22 @@
2625
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, .15);
2726
padding: 0.8rem;
2827

29-
font-size: 1rem;
28+
font-size: 0.875rem;
3029
font-weight: normal;
3130
font-style: normal;
3231

32+
.tooltip-content {
33+
display: flex;
34+
flex-flow: column nowrap;
35+
color: var(--site-secondary-textColor);
36+
}
37+
3338
.tooltip-header {
3439
font-size: 1.2rem;
3540
font-weight: 500;
3641
margin-bottom: 0.25rem;
3742
}
3843

39-
.tooltip-content {
40-
font-size: 0.875rem;
41-
color: var(--site-secondary-textColor);
42-
}
4344
}
4445

4546
// On non-touch devices, show tooltip on hover or focus.
@@ -53,10 +54,10 @@
5354
}
5455
}
5556

56-
// On touch devices, show tooltip on click (see global_scripts.dart).
57+
// On touch devices, show tooltip on click.
5758
@media all and (pointer: coarse) {
5859
.tooltip.visible {
5960
visibility: visible;
6061
}
6162
}
62-
}
63+
}

site/lib/main.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import 'src/components/pages/expansion_list.dart';
2121
import 'src/components/pages/learning_resource_index.dart';
2222
import 'src/components/tutorial/progress_ring.dart';
2323
import 'src/components/tutorial/quiz.dart';
24+
import 'src/components/util/component_ref.dart';
2425
import 'src/extensions/registry.dart';
2526
import 'src/layouts/catalog_page_layout.dart';
2627
import 'src/layouts/doc_layout.dart';
@@ -36,7 +37,7 @@ void main() {
3637
// Initializes the server environment with the generated default options.
3738
Jaspr.initializeApp(options: defaultJasprOptions);
3839

39-
runApp(_docsFlutterDevSite);
40+
runApp(ComponentRefScope(child: _docsFlutterDevSite));
4041
}
4142

4243
Component get _docsFlutterDevSite => ContentApp.custom(

0 commit comments

Comments
 (0)