From 2ec2161a7e1c0787b5e9ea14311f19c6b6a52d63 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 22 Oct 2021 01:31:46 -0300 Subject: some storybook exmaples --- .../anastasis-webui/src/pages/home/SolveQuestionEntry.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'packages/anastasis-webui/src/pages/home/SolveQuestionEntry.tsx') diff --git a/packages/anastasis-webui/src/pages/home/SolveQuestionEntry.tsx b/packages/anastasis-webui/src/pages/home/SolveQuestionEntry.tsx index 6393958b3..72dadbe89 100644 --- a/packages/anastasis-webui/src/pages/home/SolveQuestionEntry.tsx +++ b/packages/anastasis-webui/src/pages/home/SolveQuestionEntry.tsx @@ -1,14 +1,15 @@ import { h, VNode } from "preact"; import { useState } from "preact/hooks"; +import { useAnastasisContext } from "../../context/anastasis"; import { AnastasisClientFrame, LabeledInput } from "./index"; import { SolveEntryProps } from "./SolveScreen"; -export function SolveQuestionEntry(props: SolveEntryProps): VNode { +export function SolveQuestionEntry({ challenge, feedback }: SolveEntryProps): VNode { const [answer, setAnswer] = useState(""); - const { reducer, challenge, feedback } = props; - const next = (): void => reducer.transition("solve_challenge", { - answer, - }); + const reducer = useAnastasisContext() + const next = (): void => { + if (reducer) reducer.transition("solve_challenge", { answer }) + }; return (