ui/stepper: use initial step from opts
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
|||||||
createContext,
|
createContext,
|
||||||
createSignal,
|
createSignal,
|
||||||
JSX,
|
JSX,
|
||||||
Setter,
|
|
||||||
useContext,
|
useContext,
|
||||||
} from "solid-js";
|
} from "solid-js";
|
||||||
import { createStore, SetStoreFunction, Store } from "solid-js/store";
|
import { createStore, SetStoreFunction, Store } from "solid-js/store";
|
||||||
@@ -28,7 +27,9 @@ export function createStepper<
|
|||||||
s: { steps: T },
|
s: { steps: T },
|
||||||
stepOpts: StepOptions<StepId, StoreType>,
|
stepOpts: StepOptions<StepId, StoreType>,
|
||||||
): StepperReturn<T, T[number]["id"]> {
|
): StepperReturn<T, T[number]["id"]> {
|
||||||
const [history, setHistory] = createSignal<T[number]["id"][]>(["init"]);
|
const [history, setHistory] = createSignal<T[number]["id"][]>([
|
||||||
|
stepOpts.initialStep,
|
||||||
|
]);
|
||||||
|
|
||||||
const activeStep = () => history()[history().length - 1];
|
const activeStep = () => history()[history().length - 1];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user