Skip to content

Commit 294cf20

Browse files
committed
Refactor H5P skill page layout to enhance readability and structure; implement step markers for improved user navigation
1 parent bc3ee5a commit 294cf20

2 files changed

Lines changed: 41 additions & 34 deletions

File tree

‎src/assets/site.css‎

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -574,27 +574,27 @@ tbody th a:hover code { text-decoration: underline; }
574574
.footer-links a { color: var(--muted); text-decoration: none; }
575575
.footer-links a:hover { color: var(--text); text-decoration: underline; }
576576

577-
/* The h5p-author skill's files, /h5p/skill/: whole addresses, which give way on a phone. */
578-
.skill-files a { overflow-wrap: anywhere; }
577+
/* The H5P pages, the build page and the skill's: one wide column, its prose at --measure, and its
578+
sections as steps. */
579+
:is(.build, .skill) { max-width: var(--page-width); }
580+
.build-brand { margin-bottom: 1.25rem; font-size: 0.9375rem; }
581+
/* A longer heading than the docs' package names, so it gives way on a phone. */
582+
:is(.build, .skill) .docs-header h1 { font-size: clamp(1.75rem, 1.2rem + 3vw, 2.25rem); }
583+
/* Prose keeps a line a reader can follow; the source, the lists and what plays take the whole width. */
584+
:is(.build, .skill) p:not(.status) { max-width: var(--measure); }
579585

580586
/* H5P build page, /h5p/build/ */
581587
.build {
582-
max-width: var(--page-width);
583588
--ok: var(--live);
584589
--bad: var(--t-tag);
585590
/* Masked, like the preview pane's icons, so they take a color like text does. */
586591
--icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
587592
--icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 5v8.5M12 18.5v.01'/%3E%3C/svg%3E");
588593
}
589-
.build-brand { margin-bottom: 1.25rem; font-size: 0.9375rem; }
590-
/* A longer heading than the docs' package names, so it gives way on a phone. */
591-
.build .docs-header h1 { font-size: clamp(1.75rem, 1.2rem + 3vw, 2.25rem); }
592-
/* Prose keeps a line a reader can follow; the source, the lists and what plays take the whole width. */
593-
.build p:not(.status) { max-width: var(--measure); }
594-
595-
/* The steps are a timeline: a marker for each, on a rail that runs on to the next. A step the page
596-
hides, as the files of a source that names none, is not on it, and the rail ends at the last shown. */
597-
.build .step {
594+
/* The steps are a timeline, on this page and the skill's: a marker for each, on a rail that runs on
595+
to the next. A step the page hides, as the files of a source that names none, is not on it, and
596+
the rail ends at the last shown. How a step stands, done or wrong, is the build page's alone. */
597+
.step {
598598
--marker: 2rem;
599599
--indent: calc(var(--marker) + 1rem);
600600
/* How the step stands, which the rules under these set from what the page says of it. */
@@ -605,7 +605,7 @@ tbody th a:hover code { text-decoration: underline; }
605605
position: relative;
606606
padding: 0 0 1.5rem var(--indent);
607607
}
608-
.build .docs-header + .step { margin-top: 2.5rem; }
608+
.docs-header + .step { margin-top: 2.5rem; }
609609
/* The source is JSON, every file it names is chosen, the build is ready: the step is done. */
610610
.build .step:is(
611611
:has(#source-state[data-state="ok"]),
@@ -626,7 +626,7 @@ tbody th a:hover code { text-decoration: underline; }
626626
}
627627

628628
/* The rail, from under a step's marker to the next one's. It is a border, which forced colors keep. */
629-
.build .step::before {
629+
.step::before {
630630
content: "";
631631
position: absolute;
632632
top: calc(var(--marker) + 0.5rem);
@@ -637,14 +637,14 @@ tbody th a:hover code { text-decoration: underline; }
637637
transition: border-color 0.2s, opacity 0.3s, scale 0.3s ease-out;
638638
}
639639
/* None from the last step shown: it is drawn down to a step as that one joins. */
640-
.build .step:not(:has(~ .step:not([hidden])))::before { opacity: 0; }
640+
.step:not(:has(~ .step:not([hidden])))::before { opacity: 0; }
641641
/* A step that joins the others, the files or the play, comes in. */
642642
#files-step, #play-step { transition: opacity 0.3s ease-out, translate 0.3s ease-out; }
643643
@starting-style {
644644
#files-step, #play-step { opacity: 0; }
645645
}
646646

647-
.build .step h2 {
647+
.step h2 {
648648
display: flex;
649649
align-items: center;
650650
min-height: var(--marker);
@@ -752,16 +752,20 @@ tbody th a:hover code { text-decoration: underline; }
752752
.build .status[data-state="building"] { border-left-color: var(--focus); background: var(--tint); }
753753
.build .status[data-state="ready"] { border-left-color: var(--ok); }
754754
.build .status[data-state="error"] { border-left-color: var(--bad); }
755-
/* The problems, the notes and the files, a row each. */
756-
.build .messages, .build .file-list {
755+
/* The problems, the notes and the files, a row each; on the skill page, its addresses. */
756+
.build .messages, .build .file-list, .skill-files {
757757
padding: 0;
758758
border: 1px solid var(--border);
759759
border-radius: var(--radius);
760760
background: var(--raised);
761761
list-style: none;
762762
}
763-
.build .messages li, .build .file-list li { margin: 0; padding: 0.55rem 0.85rem; overflow-wrap: anywhere; }
764-
.build .messages li + li, .build .file-list li + li { border-top: 1px solid var(--border); }
763+
.build .messages li, .build .file-list li, .skill-files li { margin: 0; padding: 0.55rem 0.85rem; overflow-wrap: anywhere; }
764+
.build .messages li + li, .build .file-list li + li, .skill-files li + li { border-top: 1px solid var(--border); }
765+
/* A whole address in the site's mono font, and what the file is, muted, after it. */
766+
.skill-files { color: var(--muted); }
767+
.skill-files li { font-size: 0.875rem; }
768+
.skill-files a { font-family: var(--mono); font-size: 0.9375em; }
765769
/* A file's name, then whether it is chosen: at the row's end where both fit on a line, under the name where they do not. */
766770
.build .file-list li {
767771
position: relative;
@@ -793,7 +797,7 @@ tbody th a:hover code { text-decoration: underline; }
793797
.player-box h5p-player { display: block; }
794798

795799
@media (max-width: 480px) {
796-
.build .step { --marker: 1.75rem; --indent: calc(var(--marker) + 0.75rem); }
800+
.step { --marker: 1.75rem; --indent: calc(var(--marker) + 0.75rem); }
797801
.step-marker { font-size: 0.8125rem; }
798802
/* The last step has no rail beside it, so on a phone what plays takes the column's whole width. */
799803
.player-box { margin-left: calc(-1 * var(--indent)); }
@@ -807,7 +811,7 @@ tbody th a:hover code { text-decoration: underline; }
807811

808812
/* What moves, only where motion is not asked to be reduced: the rail drawn down, a step coming up, the ring turning. */
809813
@media (prefers-reduced-motion: no-preference) {
810-
.build .step:not(:has(~ .step:not([hidden])))::before { scale: 1 0; }
814+
.step:not(:has(~ .step:not([hidden])))::before { scale: 1 0; }
811815
@starting-style {
812816
#files-step, #play-step { translate: 0 0.5rem; }
813817
}

‎src/h5p/skill/index.njk‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,19 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self'; o
3434
</p>
3535
</header>
3636

37-
<section aria-labelledby="first-heading">
38-
<h2 id="first-heading">Read first</h2>
39-
<ul class="skill-files">
37+
{#- The sections are steps, in the order a chat reads them, drawn as the build page's timeline
38+
(site.css). The lists are drawn without bullets, and Safari then reads one as a list only if
39+
it is told. -#}
40+
<section class="step" aria-labelledby="first-heading">
41+
<h2 id="first-heading"><span class="step-marker"><span class="step-number">1</span></span> Read first</h2>
42+
<ul class="skill-files" role="list">
4043
<li><a href="{{ base }}SKILL.md">{{ base }}SKILL.md</a>: the skill's steps</li>
4144
</ul>
4245
</section>
4346

44-
<section aria-labelledby="named-heading">
45-
<h2 id="named-heading">The files it names</h2>
46-
<ul class="skill-files">
47+
<section class="step" aria-labelledby="named-heading">
48+
<h2 id="named-heading"><span class="step-marker"><span class="step-number">2</span></span> The files it names</h2>
49+
<ul class="skill-files" role="list">
4750
{%- for path in skill.named %}
4851
<li><a href="{{ base }}{{ path }}">{{ base }}{{ path }}</a>
4952
{%- if path == "references/authoring.md" %}: the brief, read once
@@ -52,27 +55,27 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self'; o
5255
</ul>
5356
</section>
5457

55-
<section aria-labelledby="types-heading">
56-
<h2 id="types-heading">A content type's file</h2>
58+
<section class="step" aria-labelledby="types-heading">
59+
<h2 id="types-heading"><span class="step-marker"><span class="step-number">3</span></span> A content type's file</h2>
5760
<p>
5861
One per content type: its notes, an example and its fields. Read the file of the type the
5962
source is written in, and those of the parts it holds, such as H5P.AdvancedText or H5P.Image.
6063
</p>
61-
<ul class="skill-files">
64+
<ul class="skill-files" role="list">
6265
{%- for path in skill.types %}
6366
<li><a href="{{ base }}{{ path }}">{{ base }}{{ path }}</a></li>
6467
{%- endfor %}
6568
</ul>
6669
</section>
6770

68-
<section aria-labelledby="bundles-heading">
69-
<h2 id="bundles-heading">To build where npm cannot be reached</h2>
71+
<section class="step" aria-labelledby="bundles-heading">
72+
<h2 id="bundles-heading"><span class="step-marker"><span class="step-number">4</span></span> To build where npm cannot be reached</h2>
7073
<p>
7174
The build tool, which runs with Node and nothing installed, and a bundle per content type:
7275
the libraries a build of that type reads. Fetch the tool and the bundle of the source's own
7376
type, as step 3 of <code>SKILL.md</code> says.
7477
</p>
75-
<ul class="skill-files">
78+
<ul class="skill-files" role="list">
7679
{%- for file in skill.bundles %}
7780
<li><a href="{{ bundlesBase }}{{ file }}">{{ bundlesBase }}{{ file }}</a>
7881
{%- if file == "h5p-author.mjs" %}: the build tool{% endif %}</li>

0 commit comments

Comments
 (0)