Skip to content

Commit 220105b

Browse files
authored
Merge pull request #8412 from igrep/tutorial-fix-show-me-button
docs: "Show Me" button state in tutorial is not in sync with code
2 parents 31a698e + 069123d commit 220105b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/docs/src/routes/tutorial/layout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default component$(() => {
3131
entryStrategy: 'segment',
3232
files: [],
3333
version: '',
34+
isShowingSolution: false,
3435
};
3536
return initStore;
3637
});
@@ -47,6 +48,7 @@ export default component$(() => {
4748
store.appId = t.app.id;
4849
store.prev = t.prev;
4950
store.next = t.next;
51+
store.isShowingSolution = false;
5052
});
5153

5254
return (
@@ -166,6 +168,7 @@ export interface TutorialStore extends ReplAppInput {
166168
app: TutorialApp;
167169
prev: TutorialApp | undefined;
168170
next: TutorialApp | undefined;
171+
isShowingSolution: boolean;
169172
}
170173

171174
export const PANELS = ['Tutorial', 'Input', 'Output'];

packages/docs/src/routes/tutorial/tutorial-content-footer.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
import { component$, useSignal } from '@builder.io/qwik';
1+
import { component$ } from '@builder.io/qwik';
22
import { ensureDefaultFiles, type TutorialStore } from './layout';
33
import { Link } from '@builder.io/qwik-city';
44

55
export const TutorialContentFooter = component$(({ store }: TutorialContentFooterProps) => {
6-
let solutionViewSig = useSignal(false);
7-
86
return (
97
<div class="content-footer">
108
<div>
11-
{solutionViewSig.value ? (
9+
{store.isShowingSolution ? (
1210
<button
1311
preventdefault:click
1412
class="show-me"
1513
onClick$={() => {
1614
store.files = ensureDefaultFiles(store.app.problemInputs);
17-
solutionViewSig.value = false;
15+
store.isShowingSolution = false;
1816
}}
1917
type="button"
2018
>
@@ -26,7 +24,7 @@ export const TutorialContentFooter = component$(({ store }: TutorialContentFoote
2624
class="show-me"
2725
onClick$={() => {
2826
store.files = ensureDefaultFiles(store.app.solutionInputs);
29-
solutionViewSig.value = true;
27+
store.isShowingSolution = true;
3028
}}
3129
type="button"
3230
>

0 commit comments

Comments
 (0)