@allons-y/course-kit 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/scripts/deck.js +3 -34
- package/assets/styles/base.css +135 -2
- package/assets/styles/print.css +8 -1
- package/components/practice/practice-worksheet.webc +1 -5
- package/components/site/book-appointment.webc +26 -0
- package/components/site/course-now.webc +7 -0
- package/components/site/glossary.webc +0 -5
- package/components/site/instructor.webc +3 -3
- package/components/site/masthead.webc +11 -1
- package/components/site/nav-links.webc +16 -0
- package/components/site/schedule-overview.webc +204 -17
- package/components/site/schedule-weeks.webc +24 -51
- package/components/site/site-footer.webc +16 -2
- package/components/ui/codepen-embed.webc +2 -5
- package/components/ui/download-button.webc +3 -3
- package/components/ui/table-rubric.webc +2 -1
- package/examples/starter/_data/schedule.json +1 -1
- package/layouts/deck.webc +0 -4
- package/layouts/document.webc +2 -1
- package/layouts/lesson.webc +8 -12
- package/lib/check.js +23 -1
- package/lib/copy.js +1 -3
- package/lib/data/glossary.js +2 -3
- package/lib/data/site.js +2 -1
- package/lib/filters.js +64 -27
- package/lib/lesson-materials.js +3 -2
- package/lib/pdf.js +7 -1
- package/lib/plugin.js +3 -1
- package/lib/postcss.js +3 -1
- package/package.json +2 -1
- package/schemas/course.schema.json +5 -0
- package/schemas/instructor.schema.json +20 -0
- package/schemas/worksheet.schema.json +6 -1
- package/assets/scripts/theme-restore.js +0 -17
package/README.md
CHANGED
package/assets/scripts/deck.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Slide deck controller: which slide is showing
|
|
2
|
+
* Slide deck controller: which slide is showing. The deck's colors follow the
|
|
3
|
+
* system light/dark setting, like the rest of the site. Speaker
|
|
3
4
|
* notes never reach a deck; they live on the instructor notes sheet.
|
|
4
5
|
* Loaded only by _layouts/deck.webc, a standalone document with none of the
|
|
5
6
|
* site chrome (masthead, base.css).
|
|
6
7
|
*
|
|
7
8
|
* Keys: → ↓ Space PageDown next, ← ↑ PageUp previous, Home/End ends,
|
|
8
|
-
* Enter reveal,
|
|
9
|
+
* Enter reveal, F fullscreen.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
const deck = document.querySelector(".deck");
|
|
@@ -14,32 +15,6 @@ const counter = document.querySelector("[data-count]");
|
|
|
14
15
|
const fullscreenToggle = document.querySelector("[data-toggle-fullscreen]");
|
|
15
16
|
const root = document.documentElement;
|
|
16
17
|
|
|
17
|
-
/* The deck's own light/dark/system choice, kept for the next time it opens.
|
|
18
|
-
The site has no switcher and always follows the system. */
|
|
19
|
-
const THEME_KEY = "theme";
|
|
20
|
-
const THEMES = ["system", "light", "dark"];
|
|
21
|
-
|
|
22
|
-
const readTheme = () => {
|
|
23
|
-
try {
|
|
24
|
-
const stored = localStorage.getItem(THEME_KEY);
|
|
25
|
-
return THEMES.includes(stored) ? stored : "system";
|
|
26
|
-
} catch {
|
|
27
|
-
return "system";
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const applyTheme = (theme) => {
|
|
32
|
-
root.style.colorScheme = theme === "system" ? "light dark" : theme;
|
|
33
|
-
root.dataset.theme = theme;
|
|
34
|
-
try {
|
|
35
|
-
localStorage.setItem(THEME_KEY, theme);
|
|
36
|
-
} catch {
|
|
37
|
-
/* Private browsing: the deck still themes, it just won't be remembered. */
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const cycleTheme = () => applyTheme(THEMES[(THEMES.indexOf(readTheme()) + 1) % THEMES.length]);
|
|
42
|
-
|
|
43
18
|
/* lock() needs fullscreen and is Android-only; iOS has neither. Every step
|
|
44
19
|
is feature-detected and fails quietly. */
|
|
45
20
|
const toggleFullscreen = async () => {
|
|
@@ -131,9 +106,6 @@ document.addEventListener("keydown", (event) => {
|
|
|
131
106
|
return go(0);
|
|
132
107
|
case "End":
|
|
133
108
|
return go(slides.length - 1);
|
|
134
|
-
case "t":
|
|
135
|
-
case "T":
|
|
136
|
-
return cycleTheme();
|
|
137
109
|
case "f":
|
|
138
110
|
case "F":
|
|
139
111
|
event.preventDefault();
|
|
@@ -151,11 +123,8 @@ if (fullscreenToggle && document.fullscreenEnabled) {
|
|
|
151
123
|
fullscreenToggle.hidden = false;
|
|
152
124
|
fullscreenToggle.addEventListener("click", toggleFullscreen);
|
|
153
125
|
}
|
|
154
|
-
document.querySelector("[data-toggle-theme]").addEventListener("click", cycleTheme);
|
|
155
126
|
document.querySelector("[data-prev]").addEventListener("click", () => setIndex(index - 1));
|
|
156
127
|
document.querySelector("[data-next]").addEventListener("click", next);
|
|
157
128
|
|
|
158
|
-
applyTheme(readTheme());
|
|
159
|
-
|
|
160
129
|
const fromHash = Number.parseInt(location.hash.replace("#s", ""), 10);
|
|
161
130
|
setIndex(Number.isFinite(fromHash) ? fromHash - 1 : 0, Number.isFinite(fromHash));
|
package/assets/styles/base.css
CHANGED
|
@@ -985,7 +985,8 @@ eyebrow + :where(h1, h2, h3, h4, h5, h6) {
|
|
|
985
985
|
A contents column beside a document (and beside the syllabus, whose own
|
|
986
986
|
component sets where it sits), and an outline and a tools rail beside
|
|
987
987
|
a lesson plan. Only the syllabus's list is sticky, and each falls to one
|
|
988
|
-
column on a narrow screen
|
|
988
|
+
column on a narrow screen: a document's contents go after the page, the
|
|
989
|
+
lesson plan's side columns first. */
|
|
989
990
|
.rail-label {
|
|
990
991
|
margin: 0 0 0.5em;
|
|
991
992
|
color: var(--color-text-muted);
|
|
@@ -1013,9 +1014,31 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1013
1014
|
|
|
1014
1015
|
.doc-layout[data-contents="true"] {
|
|
1015
1016
|
grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
|
|
1017
|
+
/* The page is first in the source; the grid puts the contents beside it, or after it on a narrow screen, so the h1 is the first thing on a phone and the visual order is the reading order. */
|
|
1018
|
+
grid-template-areas: "contents page";
|
|
1016
1019
|
|
|
1017
1020
|
@media screen and (width <= 900px) {
|
|
1018
1021
|
grid-template-columns: minmax(0, 1fr);
|
|
1022
|
+
grid-template-areas:
|
|
1023
|
+
"page"
|
|
1024
|
+
"contents";
|
|
1025
|
+
|
|
1026
|
+
> .doc-contents {
|
|
1027
|
+
margin-block-start: var(--section-space);
|
|
1028
|
+
border-block-start: var(--thin-border-width) solid var(--color-border);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
@media print {
|
|
1033
|
+
grid-template-areas: none;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
> .doc-contents {
|
|
1037
|
+
grid-area: contents;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
> .content-column {
|
|
1041
|
+
grid-area: page;
|
|
1019
1042
|
}
|
|
1020
1043
|
}
|
|
1021
1044
|
|
|
@@ -1063,7 +1086,10 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1063
1086
|
}
|
|
1064
1087
|
|
|
1065
1088
|
li a[href] {
|
|
1066
|
-
display:
|
|
1089
|
+
display: flex;
|
|
1090
|
+
align-items: center;
|
|
1091
|
+
/* An operable target: 44px tall (WCAG 2.5.5); print sets --target-min to 0. */
|
|
1092
|
+
min-block-size: var(--target-min);
|
|
1067
1093
|
margin-inline-start: calc(var(--border-width) * -1);
|
|
1068
1094
|
padding: 0.35em 0.9em;
|
|
1069
1095
|
border-inline-start: var(--border-width) solid transparent;
|
|
@@ -1099,6 +1125,19 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1099
1125
|
}
|
|
1100
1126
|
|
|
1101
1127
|
/* ---- Lesson plans (instructor) ---- */
|
|
1128
|
+
/* A list of links in a table cell: each whole-item link is a 44px target, a link inside a sentence keeps its line. */
|
|
1129
|
+
.lesson-links {
|
|
1130
|
+
margin: 0;
|
|
1131
|
+
padding: 0;
|
|
1132
|
+
list-style: none;
|
|
1133
|
+
|
|
1134
|
+
li > a:only-child {
|
|
1135
|
+
display: inline-flex;
|
|
1136
|
+
align-items: center;
|
|
1137
|
+
min-block-size: var(--target-min);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1102
1141
|
.lesson-nav {
|
|
1103
1142
|
display: flex;
|
|
1104
1143
|
gap: calc(var(--content-space) * 2);
|
|
@@ -1109,6 +1148,12 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1109
1148
|
margin: 0;
|
|
1110
1149
|
}
|
|
1111
1150
|
|
|
1151
|
+
a {
|
|
1152
|
+
display: inline-flex;
|
|
1153
|
+
align-items: center;
|
|
1154
|
+
min-block-size: var(--target-min);
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1112
1157
|
@media print {
|
|
1113
1158
|
display: none;
|
|
1114
1159
|
}
|
|
@@ -1140,6 +1185,23 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1140
1185
|
}
|
|
1141
1186
|
}
|
|
1142
1187
|
|
|
1188
|
+
/* `.separators` sets `display: flex` after the utility classes above and outranks them, so a row that is for one medium only needs its own rules. */
|
|
1189
|
+
.separators.print-only {
|
|
1190
|
+
display: none;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
.separators.screen-only {
|
|
1194
|
+
@media print {
|
|
1195
|
+
display: none;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
.separators.print-only {
|
|
1200
|
+
@media print {
|
|
1201
|
+
display: flex;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1143
1205
|
.lesson-list {
|
|
1144
1206
|
td {
|
|
1145
1207
|
font-size: max(var(--base-font-size), 0.95em);
|
|
@@ -1210,6 +1272,13 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1210
1272
|
td {
|
|
1211
1273
|
border-inline: none;
|
|
1212
1274
|
}
|
|
1275
|
+
|
|
1276
|
+
/* A link that is a direct child of a cell is an operable target: 44px tall (WCAG 2.5.5); print sets --target-min to 0. */
|
|
1277
|
+
:where(td, th) > a {
|
|
1278
|
+
display: inline-flex;
|
|
1279
|
+
align-items: center;
|
|
1280
|
+
min-block-size: var(--target-min);
|
|
1281
|
+
}
|
|
1213
1282
|
}
|
|
1214
1283
|
|
|
1215
1284
|
figure > :where(table) {
|
|
@@ -1456,6 +1525,13 @@ blockquote {
|
|
|
1456
1525
|
max-inline-size: 80ch;
|
|
1457
1526
|
}
|
|
1458
1527
|
|
|
1528
|
+
/* A link that is the whole paragraph (a policy's "full text") is a 44px target; a link inside a sentence keeps the line. */
|
|
1529
|
+
p > a:only-child {
|
|
1530
|
+
display: inline-flex;
|
|
1531
|
+
align-items: center;
|
|
1532
|
+
min-block-size: var(--target-min);
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1459
1535
|
details {
|
|
1460
1536
|
margin-block: 0;
|
|
1461
1537
|
padding: 0;
|
|
@@ -1900,6 +1976,63 @@ blockquote {
|
|
|
1900
1976
|
color: var(--color-text-muted);
|
|
1901
1977
|
}
|
|
1902
1978
|
|
|
1979
|
+
/* ---- The call-to-action button ----
|
|
1980
|
+
One primary action as a link: the accent pill, 44px tall, in the brand fill under its own text color (7:1). It needs its words, so it
|
|
1981
|
+
is never an icon. `a.cta-button[href]` outranks the prose link rules above, which underline and recolor a link inside a paragraph or
|
|
1982
|
+
list item and on hover. Motion only where the reader has not asked for less; print shows a plain underlined link. */
|
|
1983
|
+
a.cta-button[href] {
|
|
1984
|
+
display: inline-flex;
|
|
1985
|
+
align-items: center;
|
|
1986
|
+
justify-content: center;
|
|
1987
|
+
box-sizing: border-box;
|
|
1988
|
+
min-block-size: var(--target-min);
|
|
1989
|
+
min-inline-size: var(--target-min);
|
|
1990
|
+
padding: 0.6em 1.4em;
|
|
1991
|
+
border: var(--border-width) solid var(--color-accent);
|
|
1992
|
+
border-radius: var(--radius-pill);
|
|
1993
|
+
background-color: var(--color-accent);
|
|
1994
|
+
color: var(--color-on-accent);
|
|
1995
|
+
font-weight: var(--font-weight--semi-bold);
|
|
1996
|
+
line-height: var(--font-height);
|
|
1997
|
+
text-align: center;
|
|
1998
|
+
text-decoration: none;
|
|
1999
|
+
|
|
2000
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
2001
|
+
transition:
|
|
2002
|
+
background-color 150ms ease-out,
|
|
2003
|
+
border-color 150ms ease-out;
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
&:is(:hover, :focus, :focus-visible) {
|
|
2007
|
+
background-color: var(--color-accent-fill-hover);
|
|
2008
|
+
border-color: var(--color-accent-fill-hover);
|
|
2009
|
+
color: var(--color-on-accent);
|
|
2010
|
+
text-decoration: none;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
/* A forced palette drops the fill, so the pill is its outline and its text. */
|
|
2014
|
+
@media (forced-colors: active) {
|
|
2015
|
+
border-color: LinkText;
|
|
2016
|
+
color: LinkText;
|
|
2017
|
+
|
|
2018
|
+
&:is(:hover, :focus, :focus-visible) {
|
|
2019
|
+
border-color: Highlight;
|
|
2020
|
+
color: LinkText;
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
@media print {
|
|
2025
|
+
display: inline;
|
|
2026
|
+
min-block-size: 0;
|
|
2027
|
+
min-inline-size: 0;
|
|
2028
|
+
padding: 0;
|
|
2029
|
+
border: 0;
|
|
2030
|
+
background: none;
|
|
2031
|
+
color: inherit;
|
|
2032
|
+
text-decoration: underline;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
|
|
1903
2036
|
/* ---- The switch ----
|
|
1904
2037
|
One pill track holding two to four options: native radios for a choice that
|
|
1905
2038
|
filters (Group by), tabs for one that swaps a panel (Review / Flashcards).
|
package/assets/styles/print.css
CHANGED
|
@@ -3,13 +3,20 @@
|
|
|
3
3
|
Odd layouts are Chromium print-fragmentation workarounds. */
|
|
4
4
|
|
|
5
5
|
@media print {
|
|
6
|
+
/* The margins the syllabus PDF is generated with (lib/pdf.js). An @page margin outranks the margin option of the PDF call, so a zero here
|
|
7
|
+
printed the text to the paper's edge and put the page footer, which sits in the bottom margin, over the last line. */
|
|
6
8
|
@page {
|
|
7
9
|
size: letter;
|
|
8
|
-
margin: 0;
|
|
10
|
+
margin: 0.4in 0.5in 0.45in;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
/* Grayscale — neutralize every token. */
|
|
12
14
|
:root {
|
|
15
|
+
/* Paper is the measure: the on-screen reading cap of base.css (68ch) would narrow every paragraph, list item and definition. */
|
|
16
|
+
--measure: none;
|
|
17
|
+
/* The display face is a system serif stack that is not hosted, so a PDF built on another machine prints in whatever serif it has (Caladea on a Linux runner).
|
|
18
|
+
Print headings and run-in labels in the hosted text face, so the PDF is the same everywhere. */
|
|
19
|
+
--display-font: var(--sans-font);
|
|
13
20
|
/* A printed page has no pointer: links and summaries keep their text height. */
|
|
14
21
|
--target-min: 0px;
|
|
15
22
|
--color-text: #000;
|
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
<article class="content-column practice" id="worksheet" data-worksheet webc:if="$data.worksheet"
|
|
7
7
|
:data-storage-id="`${$data.course.code.toLowerCase()}/${$data.page.fileSlug}`">
|
|
8
8
|
<header class="practice-head">
|
|
9
|
-
<eyebrow
|
|
10
|
-
<span @text="$data.term.label"></span>
|
|
11
|
-
<span @text="$data.course.code"></span>
|
|
12
|
-
<span @text="$data.worksheet.eyebrow"></span>
|
|
13
|
-
</eyebrow>
|
|
9
|
+
<eyebrow webc:if="$data.worksheet.eyebrow" @text="$data.worksheet.eyebrow"></eyebrow>
|
|
14
10
|
<h1 @text="$data.worksheet.heading"></h1>
|
|
15
11
|
<p class="not-graded" @text="$data.worksheet.copy.notGraded"></p>
|
|
16
12
|
<p class="lede" @text="$data.worksheet.lede"></p>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script webc:setup>
|
|
2
|
+
/**
|
|
3
|
+
* The one-on-one booking button: a link to `instructor.booking.url`, labelled by `instructor.booking.label` or the `instructor.bookAnAppointment` copy key. Renders nothing when the instructor has no `booking`. `<instructor>` places it as the last line of the panel; a page, such as the contact page, can place it anywhere.
|
|
4
|
+
*/
|
|
5
|
+
</script>
|
|
6
|
+
<div webc:root="override" class="book-appointment" webc:if="$data.instructor?.booking?.url">
|
|
7
|
+
<a class="cta-button" :href="$data.instructor.booking.url" @text="$data.instructor.booking.label || $data.copy.instructor.bookAnAppointment"></a>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<style webc:scoped>
|
|
11
|
+
/* Aligned with the content's start edge, with space above it. In the instructor panel with icon links on, the column is a wrapping
|
|
12
|
+
flex row (the kit orders heading 0, icons 1, facts 2, note 3), and the button takes its own line last; anywhere else the two
|
|
13
|
+
flex properties do nothing. The pill itself is `.cta-button` in the base stylesheet. */
|
|
14
|
+
:host {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: flex-start;
|
|
17
|
+
flex: 1 1 100%;
|
|
18
|
+
order: 4;
|
|
19
|
+
margin-block-start: var(--content-space);
|
|
20
|
+
|
|
21
|
+
@media print {
|
|
22
|
+
display: block;
|
|
23
|
+
margin-block-start: 0.4em;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -288,6 +288,13 @@
|
|
|
288
288
|
font-weight: var(--font-weight--semi-bold);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
+
/* A link is an operable target: 44px tall (WCAG 2.5.5). */
|
|
292
|
+
a.what {
|
|
293
|
+
display: inline-flex;
|
|
294
|
+
align-items: center;
|
|
295
|
+
min-block-size: var(--target-min);
|
|
296
|
+
}
|
|
297
|
+
|
|
291
298
|
.due {
|
|
292
299
|
flex-basis: 100%;
|
|
293
300
|
color: var(--color-text-muted);
|
|
@@ -8,11 +8,6 @@
|
|
|
8
8
|
</script>
|
|
9
9
|
<article class="content-column glossary" id="glossary" webc:if="$data.glossary?.terms?.length">
|
|
10
10
|
<header>
|
|
11
|
-
<eyebrow class="separators">
|
|
12
|
-
<span @text="$data.term.label"></span>
|
|
13
|
-
<span @text="$data.course.code"></span>
|
|
14
|
-
<span @text="$data.copy.glossary.glossary"></span>
|
|
15
|
-
</eyebrow>
|
|
16
11
|
<h1 @text="$data.copy.glossary.courseGlossary"></h1>
|
|
17
12
|
<p class="intro">
|
|
18
13
|
<strong @text="$data.glossary.terms.length"></strong>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script webc:setup>
|
|
2
2
|
/**
|
|
3
|
-
* The instructor's details: photo, office, contact and hours. Reads `instructor`.
|
|
3
|
+
* The instructor's details: photo, office, contact and hours, then the booking button (`instructor.booking`) as the panel's last line when there is one. Reads `instructor`.
|
|
4
4
|
* @prop {'card'} [variant] a compact card instead of the full section
|
|
5
5
|
* @prop {'icons'} [contactLinks] show the email, the message link and the blog as icon links in the corner of the panel instead of rows in the fact list; the same as `contactLinks: "icons"` in `instructor.json`, and wins over it
|
|
6
6
|
*/
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
aria-hidden="true" focusable="false" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"></circle><path d="M3 12h18"></path><path d="M12 3a14 14 0 0 1 0 18a14 14 0 0 1 0-18"></path></svg><span
|
|
62
62
|
class="link-text" @text="host($data.instructor.blog)"></span></a>
|
|
63
63
|
</li>
|
|
64
|
-
</ul>
|
|
64
|
+
</ul><book-appointment></book-appointment>
|
|
65
65
|
</div>
|
|
66
66
|
</div>
|
|
67
67
|
</template>
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
<a webc:if="$data.instructor.email" :data-email="encodeEmail($data.instructor.email)" :class="$data.instructor.contact ? 'print-only' : ''"></a>
|
|
85
85
|
<a webc:if="$data.instructor.blog" class="cta" :href="$data.instructor.blog" @text="$data.instructor.blog.replace(/^https?:\/\//, '').replace(/\/$/, '')"></a>
|
|
86
86
|
</p>
|
|
87
|
-
<p class="muted note" @text="$data.instructor.note" webc:if="$data.instructor.note"></p>
|
|
87
|
+
<p class="muted note" @text="$data.instructor.note" webc:if="$data.instructor.note"></p><book-appointment></book-appointment>
|
|
88
88
|
</div>
|
|
89
89
|
</div>
|
|
90
90
|
</template>
|
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* The page header: institution, term, course title and the navigation. Reads `site`, `term` and `course`.
|
|
4
4
|
* The menu is Home, Syllabus, then every page of the site menu that has not set `menu: false`.
|
|
5
|
+
* @prop {'auto' | 1 | 2} [navColumns] how many columns the menu is set in: `auto` (the default) sets it in two columns when it has more than 3 links, so a long menu keeps the header short, and in one stack otherwise; `1` and `2` fix it either way. The same as `"navColumns"` in `course.json`, and wins over it
|
|
5
6
|
*/
|
|
7
|
+
/** Links shown in the hero menu before which the menu stays a single stack. */
|
|
8
|
+
const MAX_STACKED = 3;
|
|
9
|
+
/** The prop wins over the course's `navColumns`; `auto`, or nothing, counts the links the hero shows (the instructor's contact link is one of them). */
|
|
10
|
+
const twoColumns = (data, prop, linkCount) => {
|
|
11
|
+
const wanted = prop ?? data.course?.navColumns;
|
|
12
|
+
if (wanted === undefined || wanted === "auto") return linkCount + (data.instructor?.contact ? 1 : 0) > MAX_STACKED;
|
|
13
|
+
return Number(wanted) === 2;
|
|
14
|
+
};
|
|
6
15
|
const navItems = (() => {
|
|
7
16
|
const items = eleventyNavigation($data.collections.all);
|
|
8
17
|
const home = items.find((item) => item.url === "/");
|
|
@@ -30,7 +39,8 @@
|
|
|
30
39
|
</p>
|
|
31
40
|
</div>
|
|
32
41
|
<div class="links">
|
|
33
|
-
<nav-links column :aria-label="$data.copy.nav.site" @context="hero" :@navigation="navItems"></nav-links>
|
|
42
|
+
<nav-links column two-column webc:if="twoColumns($data, typeof navColumns === 'undefined' ? undefined : navColumns, navItems.length)" :aria-label="$data.copy.nav.site" @context="hero" :@navigation="navItems"></nav-links>
|
|
43
|
+
<nav-links column webc:else :aria-label="$data.copy.nav.site" @context="hero" :@navigation="navItems"></nav-links>
|
|
34
44
|
</div>
|
|
35
45
|
</div>
|
|
36
46
|
</header>
|
|
@@ -123,6 +123,22 @@
|
|
|
123
123
|
display: block;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/* Two columns (`two-column`, used by the hero): the same stack split into two
|
|
127
|
+
newspaper columns, read top to bottom then across, so a long list stays
|
|
128
|
+
short. Narrow screens keep the column variant's wrapped row. */
|
|
129
|
+
@media screen and (width > 768px) {
|
|
130
|
+
:host([column][two-column]) ul {
|
|
131
|
+
display: block;
|
|
132
|
+
columns: 2;
|
|
133
|
+
column-gap: calc(var(--content-space) * 2);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:host([column][two-column]) li {
|
|
137
|
+
break-inside: avoid;
|
|
138
|
+
margin-block-end: calc(var(--content-space) * 0.35);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
126
142
|
/* A stack of plain links, not pills — no border, no background. */
|
|
127
143
|
:host([column]) a,
|
|
128
144
|
:host([column]) a:visited {
|