Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions site/lib/_sass/components/_stepper.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.stepper {

details {
>details {
position: relative;
margin: 0;
padding-bottom: 1px;
Expand All @@ -25,7 +25,7 @@
display: none;
}

summary {
>summary {
position: relative;
display: flex;
align-items: center;
Expand All @@ -52,7 +52,14 @@
}

.step-title {
.header-wrapper, h1, h2, h3, h4, h5, h6 {

.header-wrapper,
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
}
}
Expand All @@ -66,7 +73,7 @@
}
}

&[open] summary {
&[open]>summary {
.step-number {
background-color: var(--site-primary-color);
color: var(--site-onPrimary-color-lightest);
Expand All @@ -77,7 +84,7 @@
}
}

&:not([open]):has(~[open]) summary .step-number {
&:not([open]):has(~[open])>summary .step-number {
background-color: var(--site-onPrimary-color-light);
color: var(--site-primary-color);
}
Expand Down
2 changes: 0 additions & 2 deletions site/lib/main.server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import 'src/components/tutorial/progress_ring.dart';
import 'src/components/tutorial/quiz.dart';
import 'src/components/tutorial/stepper.dart';
import 'src/components/tutorial/summary_card.dart';
import 'src/components/tutorial/tutorial_lesson.dart';
import 'src/components/tutorial/tutorial_outline.dart';
import 'src/components/util/component_ref.dart';
import 'src/extensions/registry.dart';
Expand Down Expand Up @@ -119,7 +118,6 @@ List<CustomComponent> get _embeddableComponents => [
const SummaryCard(),
const DownloadableSnippet(),
const Stepper(),
const TutorialLesson(),
const WidgetCatalogCategories(),
const TutorialOutline(),
const WidgetCatalogGrid(),
Expand Down
16 changes: 12 additions & 4 deletions site/lib/src/client/global_scripts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,26 @@ void _setUpSteppers() {

for (var i = 0; i < steppers.length; i++) {
final stepper = steppers.item(i) as web.HTMLElement;
final steps = stepper.querySelectorAll('details');
final children = stepper.childNodes;
final steps = [
for (var j = 0; j < children.length; j++)
if (children.item(j) case web.Element(
nodeType: web.Node.ELEMENT_NODE,
tagName: 'DETAILS',
))
children.item(j) as web.HTMLDetailsElement,
];

for (var j = 0; j < steps.length; j++) {
final step = steps.item(j) as web.HTMLDetailsElement;
final step = steps[j];

step.addEventListener(
'toggle',
((web.Event e) {
// Close all other steps when one is opened.
if (step.open) {
for (var k = 0; k < steps.length; k++) {
final otherStep = steps.item(k) as web.HTMLDetailsElement;
final otherStep = steps[k];
if (otherStep != step) {
otherStep.open = false;
}
Expand All @@ -419,7 +427,7 @@ void _setUpSteppers() {
step.open = false;
_scrollTo(step, smooth: false);
if (j + 1 < steps.length) {
final nextStep = steps.item(j + 1) as web.HTMLDetailsElement;
final nextStep = steps[j + 1];
nextStep.open = true;
_scrollTo(nextStep, smooth: true);
}
Expand Down
2 changes: 1 addition & 1 deletion site/lib/src/components/tutorial/stepper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Stepper extends CustomComponent {
attributes: {'class': 'header-wrapper'},
children: [final ElementNode heading, ..._],
) when heading.tag == 'h$level') {
steps.add((title: child, content: []));
steps.add((title: heading, content: []));
} else {
if (steps.isEmpty) {
throw Exception(
Expand Down
132 changes: 0 additions & 132 deletions site/lib/src/components/tutorial/tutorial_lesson.dart

This file was deleted.

2 changes: 2 additions & 0 deletions site/lib/src/extensions/registry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'header_extractor.dart';
import 'header_processor.dart';
import 'table_processor.dart';
import 'tutorial_prefetch_processor.dart';
import 'tutorial_structure_processor.dart';

/// A list of all node-processing, page extensions to applied to
/// content loaded with Jaspr Content.
Expand All @@ -22,4 +23,5 @@ const List<PageExtension> allNodeProcessingExtensions = [
CodeBlockProcessor(),
GlossaryLinkProcessor(),
TutorialNavigationExtension(),
TutorialStructureExtension(),
];
Loading