-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import React from "react"; | ||
import { ComponentMeta, ComponentStory } from "@storybook/react"; | ||
import DefaultInput from "../components/DefaultInput"; | ||
import Wizard from "../components/wizard/Wizard"; | ||
import { FormQuestionsContext } from "../contexts/FormQuestionsContext"; | ||
import { ConfigurationContext } from "../contexts/ConfigurationContext"; | ||
|
||
import wizardForm from "./assets/form/wizardForm.json"; | ||
import Constants from "../constants/Constants"; | ||
|
||
export default { | ||
title: "Components/Wizard", | ||
component: Wizard, | ||
} as ComponentMeta<typeof Wizard>; | ||
|
||
const Template: ComponentStory<typeof Wizard> = ( | ||
args, | ||
{ globals: { iconBehavior, locale, debugMode, horizontalNavBar } } | ||
) => { | ||
const inputComponent = DefaultInput; | ||
const componentsOptions = { | ||
readOnly: false, | ||
dateTimeAnswer: { | ||
dateFormat: "yyyy-MM-dd", | ||
timeFormat: "HH:mm:ss", | ||
dateTimeFormat: "yyyy-MM-dd HH:mm:ss", | ||
}, | ||
}; | ||
const options = { | ||
i18n: { | ||
"wizard.next": "Next", | ||
"wizard.previous": "Previous", | ||
"section.expand": "Expand", | ||
"section.collapse": "Collapse", | ||
}, | ||
intl: { | ||
locale: locale, | ||
}, | ||
modalView: false, | ||
horizontalWizardNav: horizontalNavBar, | ||
wizardStepButtons: true, | ||
enableForwardSkip: true, | ||
startingStep: 1, | ||
debugMode: debugMode, | ||
users: [ | ||
{ id: "http://fel.cvut.cz/people/max-chopart", label: "Max Chopart" }, | ||
{ | ||
id: "http://fel.cvut.cz/people/miroslav-blasko", | ||
label: "Miroslav Blasko", | ||
}, | ||
], | ||
currentUser: "http://fel.cvut.cz/people/max-chopart", | ||
icons: [ | ||
{ | ||
id: Constants.ICONS.QUESTION_HELP, | ||
behavior: iconBehavior, | ||
}, | ||
{ | ||
id: Constants.ICONS.QUESTION_LINK, | ||
behavior: iconBehavior, | ||
}, | ||
{ | ||
id: Constants.ICONS.QUESTION_COMMENTS, | ||
behavior: iconBehavior, | ||
}, | ||
], | ||
}; | ||
|
||
const getFormQuestionsData = () => { | ||
return wizardForm; | ||
}; | ||
const _getComponentMappingFunction = () => { | ||
return (question: any, defaultComponent: any) => { | ||
return defaultComponent; | ||
}; | ||
}; | ||
const mapComponent = _getComponentMappingFunction(); | ||
return ( | ||
<ConfigurationContext.Provider | ||
value={{ | ||
componentsOptions, | ||
inputComponent, | ||
mapComponent, | ||
options, | ||
}} | ||
> | ||
<FormQuestionsContext.Provider value={{ getFormQuestionsData }}> | ||
<Wizard /> | ||
</FormQuestionsContext.Provider> | ||
</ConfigurationContext.Provider> | ||
); | ||
}; | ||
|
||
export const Default = Template.bind({}); |
Large diffs are not rendered by default.
Oops, something went wrong.